Lets say there are some words or numbers on the website in front of me. I want to make a program that will take those specific words/numbers and change them to something else. Currently, I'm going about doing this using a google extension and coding some JS as a content script. I have been trying to figure out a way for so long. I want it to be general and work on multiple websites as I can't hard-code the ids and classes that point to the values (that I need) for every single website.
I have tried querySelectorAll, document.someMethod, and even window.find() to no avail.
Here are some other thoughts I had that might help you answer my question.
Is there a way to get the HTML code from the website and turn it into an array, loop through the document and use if statements to find what specific words and numbers I need, then finally change them using my JS code? What about just taking out all of the ids and classes from the HTML and doing a check to see if it has anything to do with the specific values I want.
main.js (content script)
// How do I generalize querySelectorAll to take every instance of IDS or class names that follow a specific pattern? Lets say I wanted to change the values of each element in the HTML code that had IDs related to the string "titles".
ids = document.querySelectorAll('')
If you need clarification or details please ask and I will give it right away.