I am just beginning to learn Javascript, so my terminology might be off, apologies.
I am writing a Tampermonkey script. This should search a page for a keyword ("beer") and, when found, have the keyword highlighted in red. Right now, I am only concerned about HOW to search the applicable part of the HTML file and trigger the highlighting action:
1) Can I search the string in the below
<div id="appLongDescription"
style="white-space: normal; word-wrap: break-word;">
This sentence contains beer.
</div>
by doing this?
var name = document.getElementById("appLongDescription").str.search("bier");
2) and then build a condition for the highlighter based on whether
name != -1
?
Thanks!