Home >Web Front-end >JS Tutorial >jQuery context attribute usage example_jquery
The example in this article describes the usage of jQuery’s context attribute. Share it with everyone for your reference. The specific analysis is as follows:
This attribute can return the original DOM node content passed to jQuery(), which is the second parameter value of the jQuery() method.
If the jQuery() method does not specify this parameter, then context points to the current document.
Grammar structure:
Example code:
Example 1:
By default, the original DOM node passed to jQuery() is Document, which will return [object] in IE browser and [object HTMLDocument] in other browsers.
Example 2:
The return value of the above code is [object HTMLUListElement], but in IE browser it is [object]
I hope this article will be helpful to everyone’s jQuery programming.