I have a file.js
to perform some calculation,
file.js
(function () {
var x =1;
var y = //value from dom
z = x +y;
})()
I run it in popup.js via
popup.js
function excute() {
chrome.tabs.executeScript({
file: 'file.js'
});
}
excute();
popup.html
<html>
<head>
<title>title</title>
</head>
<body>
<script type="text/javascript" src="popup.js"></script>
<input type="text" id="info">
</body>
</html>
When I click on the extension the code in the file.js
is executed on the DOM and get the y value! and the z variable is calculated properly!
But my issue
- I can't get and show variable z from
file.js
in a control at<input type="text" id="info">
inpopup.html
- I can't get the value of
<input type="text" id="info">
inpopup.html
and set it to the variable z infile.js