.context    ** REMOVED **S2C 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 1.10 and removed in jQuery 3.0 so we are just showing it for completeness.

Syntax


Signature Description
.contextThe original context passed to jQuery().

Parameters

None.

Return

An element from the DOM or the document context.

.context ExampleTop

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); 
  });
}); 

Press the button below to action the above code: