Home >Web Front-end >JS Tutorial >The second parameter of the jQuery function gets the DOM element in the specified context_jquery
The second parameter of the jQuery function can specify the search range of DOM elements.
The second parameter can be divided into the following types
DOM reference
jQuery wrapper
document
Code example
类型 | 用法 |
---|---|
jQuery wrapper | <font face="NSimsun">$('input', $('form')).length</font> |
DOM reference | <font face="NSimsun">$('input', document.forms[0]).length</font> |
document | <font face="NSimsun">$('input', 'body').length</font> |