The example in this article summarizes the method of finding nodes in js. Share it with everyone for your reference. The specific analysis is as follows:
Here are three ways to find nodes:
1. Search based on id, the return value is an object:
Special note: At present, some browsers have extended getElementsByName to other element nodes, that is, if div/p... and other tags have a name attribute, they can also be used; however, IE browsers can only be used in forms. Therefore, to maintain compatibility, it should only be used within forms.
I hope this article will be helpful to everyone’s JavaScript programming design.