My problem appears to be quite similar to this problem: Document.querySelector returns null until element is inspected using DevTools, however there are some significant differences that are quite confusing and suggest that the problem may be different. I’m trying to write code that replaces text in the input box on Google Chat, so I am using document.querySelector. The input field
Tag: selectors-api
Selecting element from DOM with Puppeteer and Node
I am using Node and Puppeteer to scrape some information from webpage I am having issues with selecting the right elements. This describes the exact situation. I want to select only the ‘Hello’ text which is always in the first child. The only difference is that there are like 50 pieces of DOM exactly like this and I want to
querySelectorAll for element contain specific class
I have few divs that contain two classes such as this: where {{month.year + ‘-‘ + month.monthName + ‘-‘ + ‘end’}} for a certain month is 2018-August-end I want to select the divs that contain only 2018-August-end which I store into a variable so I tried something like this but I get this error Uncaught DOMException: Failed to execute ‘querySelectorAll’
Getting selected options with querySelectorAll
I wonder if it’s possible in Javascript to get the currently selected options in a <select multiple> field using the Selctors API rather than a “stupid” iteration over all options. select.querySelectorAll(‘option[selected=”selected”]’) only returns the options that were marked as preselected in the original HTML, which is not what I’m looking for. Any ideas? Answer document.querySelectorAll(‘option:checked’) Works even on IE9 😉
How to remove elements that were fetched using querySelectorAll?
This seems like something that would have a quick answer, but I can’t find one. Maybe I’m searching the wrong terms? No libraries please, though I don’t need cross-browser fallbacks, I’m targeting all the latest versions on this project. I’m getting some elements: This is working, but how do I now delete these elements? Do I have to loop through