.context
** REMOVED **
JQ Home <<
Core & Internals <<
.context
The original context passed to jQuery().
Description
The .context
property holds the original context passed to jQuery() which could be a DOM node context, or generally the document context, if no node was passed.
This method was deprecated in jQuery 3.5 and removed in jQuery 3.0.
Syntax
Signature | Description |
---|---|
.context | The original context passed to jQuery(). |
Parameters
None.
Return
An element from the DOM or the document context.
.context
Example
Core << Top
The original context passed to jQuery() which could be a DOM node context, or generally the document context, if no node was passed.
The example below no longer works from jQuery 3.0 onwards and is just shown as an example for people using earlier versions.
$(function(){
$('#btn').on('click', function() {
var context = $('*').context;
alert(context);
});
});
Related Tutorials
jQuery Basic Tutorials - Lesson 2 - jQuery Core & Internals