I'm new to javascript and writing extensions. I have a content script that fills out "N/A" in a few fields on a site I use for work. Here's what it looks like:
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
try {
document.querySelector("#anchorInvArea_2 > td.layout-column > md-input-container > div.md-errors-spacer > div").innerHTML = '3 / 5000';
document.getElementById("Note_2").value = "N/A";
sendResponse({status: "Success!"});
} catch (error) {
console.log(error)
sendResponse({status: "Exception occurred!"});
}
}
);
Here's my manifest:
{
"name": "LBOT",
"version": "1.0",
"manifest_version": 3,
"icons": {
"16": "1.png",
"32": "1.png",
"48": "1.png",
"128": "1.png"
},
"action": {
"default_popup": "ext/index.html",
"default_icon": {
"16": "1.png",
"32": "1.png",
"48": "1.png",
"128": "1.png"
}
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["content.js"]
}
],
"permissions": ["activeTab"]
}
So you can see here, I'm not only filling "N/A" in a box, i'm also attempting to register a character count increase, hoping the site will recognize and accept my input. It does not accept my input. I have to manually write N/A overtop of the already inserted N/A (inserted by my extension) and then it works. I can't figure out why it doesn't work. Is there a better way to do this? or something else I can try?