jQuery | context Property
The DOM node context contains original passed to jQuery(), Which is a dom node context if there is no node passed then context will be the document.
Syntax:
context
Examples:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> context demo </title> <script src= </script> <script> $(document).ready(function() { $("button").click(function() { $("ul") .append("<li>" + $("ul") .context + "</li>") .append("<li>" + $("ul", document.body) .context.nodeName + "</li>"); }); }); </script> </head> <body> <h1 style="color:green;"> GeeksForGeeks </h1> Context: <ul></ul> <button>Click</button> </body> </html> |
chevron_right
filter_none
Output:
Before Click:

After Click:

Note: The context property was removed in jQuery version 3.0.
Recommended Posts:
- jQuery | jQuery.support Property
- jQuery | jQuery.fx.interval Property with example
- jQuery | jquery Property
- jQuery | jQuery.fx.off Property
- jQuery | length property
- jQuery | event.currentTarget Property
- jQuery | event.which property with Examples
- jQuery | event.relatedTarget Property with Example
- jQuery | event.delegateTarget Property
- Get the numeric part of CSS property using jQuery
- jQuery | event.timeStamp property with Example
- jQuery | event.target Property with Example
- jQuery | event.data Property
- jQuery | event.namespace Property
- jQuery | event.result Property with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



