Home > Article > Web Front-end > JavaScript study notes (18) Obtain the element code in the page_Basic knowledge
1. Get the element
getElementById() method, get the element through the id of the element, accept a parameter to get the id of the element, if the id does not exist, return null
Be careful not to let the name of the form element and The IDs of other elements are the same. IE browsers below IE8 use this method to obtain the element through the name attribute of the element
Take the following element as an example