Definition and usage
element selector selects elements with the specified tag name.
Tag nameQuote The text between the < and > of the HTML tag.
Syntax
$(tagname)
Parameters Description
tagname required. Specifies the name of the element to be selected.
Under IE and Firefox, the methods of dynamically creating elements are different.
The following code can be run under IE, but an error will be reported under Firefox
var theform = document.forms[0]; theform.appendChild(document.createElement("<input type='hidden' name='EVENTTARGET'>")); 在 Firefox 只支持:document.createElement('input')
If If you add attributes and events, you need to use the setAttribute method
Use jquery to dynamically create elements, which can support IE and Firefox
var theform = document.forms[0]; $("<input type='hidden' name='EVENTTARGET'>").appendTo(theform);
The above is the detailed content of Introduction to the usage of jQuery selector element. For more information, please follow other related articles on the PHP Chinese website!