In popup.js i\'m using the following code to display all the text within a certain div id of the current tab - and display in alert. I\'m wondering how would it be possible
Use the following code,
var getText = Array();
chrome.tabs.executeScript(tabs[tab].id, {
"code": "document.getElementById(\"_Your_ID_Here_\").innerText.split(' ')"
}, function (result) {
for (i = 0; i < result[0].length; i++)
getText [i] = result[0][i];
console.log(getText);
});
You have update variable inside callback, because of async nature of chrome.api