Home >Web Front-end >JS Tutorial >Questions about querySelectorAll() under IE8_javascript skills
When using querySelector() or querySelectorAll() to find elements with name="2nd_btn", FF, chrome and IE8 will all report errors.
FF, the error reported by chrome is the same, as shown below:
Error: uncaught exception: [Exception... "An invalid or illegal string was specified" code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR )" location: ".../test/qsa.html Line: 18"]
IE8 error message: Line: 18 Error: Invalid parameter.
After thinking about it, the value of name starts with a number. You can get it by removing or modifying the number.
This tells us that when generally customizing the attribute value of a label, the attribute value cannot start with a number, nor can it contain uncommon characters such as $ and ^.
Be sure to remember to declare at the beginning of the HTML page.
Test code: