In popup.js, I use the following code to display all text inside a specific div id of the current tab - and display in the message. I am wondering how can I save div text in a variable inside popup.js?
chrome.tabs.executeScript(null,code:"alert(document.getElementById(\"DIVid\").innerText.split(' '))"});
The above works fine, but when I try this:
var getText = chrome.tabs.executeScript(null,code:"document.getElementById(\"DIVid\").innerText.split(' ')"});
or
var getText = chrome.tabs.executeScript(null,code:"document.getElementById(\"DIVid\").innerText.split(' ')"},function(response){return response});
Nothing is saved. Obviously, I'm wrong. What am I doing wrong?
source
share