I'm new to Electron, and I'm trying to do a function from a click on a menu. Below is my example.
index.html
<!DOCTYPE html>
<html lang="pt-br" dir="ltr">
<head>
<meta charset="utf-8">
<title>Electron</title>
<script src="main.js"></script>
</head>
<body>
<input type="text" name="campo" id="campo" value="">
<button type="button" name="funcao" onclick="funcao()">Função</button> <br /><br />
<input type="text" name="url" id="url">
</body>
</html>
In this example, typing something in the input "url"
and clicking on the button will show what was typed in the input "campo"
.
What I wanted to do is do the same thing but by clicking on the "Função"
menu.
main.js
(only in the part you want, which would be the part of the menu with the function below)
{
label: 'Função',
click () { funcao(); }
},
function funcao() {
document.getElementById("campo").value = document.getElementById("url").value;
}
The error is:
"ReferenceError: document is not defined"