skip to Main Content

Javascript – document.querySelector is returning null for a very simple beginner problem. I have no idea why

html is basically boiler plate <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> <script src="script.js"></script> </head> <body> <input id="text-input" required placeholder="Please input a value" /> <button id="check-btn"></button> <div id="result"></div> </body> </html> js const textInput…

VIEW QUESTION

Html – css selector issue with valid and nested invalid

I am currently trying to figure out the following situation. const invalidInput = document.querySelector('.ng-invalid:not(.no-check, .ng-invalid *)'); console.log(invalidInput.name); <div class="ng-valid no-check"> <div class="ng-invalid"> <span>(</span> <input class="ng-invalid" name="hello" id="hello"> <span>)</span> <input class="ng-invalid" name="hello2" id="hello2"> </div> </div> <br> <input class="ng-invalid" name="hello3" id="hello3"> the…

VIEW QUESTION
Back To Top
Search