When you use jQuery to get the DOM element, the jQuery object returns a reference to the element. When you use a built-in function like getElementById , you get a link to the element directly, not contained in the jQuery object.
A jQuery object is an array-like object that can contain multiple DOM elements:
var jQueryCollection = $("div");
The above line can be executed without jQuery:
var normalCollection = document.getElementsByTagName("div");
In fact, exactly what jQuery will do internally when you pass in a simple selector like a div . You can access the actual elements in the jQuery collection using the get method:
var div1 = jQueryCollection.get(0);
When you have an element or a set of elements inside a jQuery object, you can use any of the methods available in the jQuery API, whereas when you have a source element, you can only use your own JavaScript methods.
James Allardice Aug 07 2018-11-17T00: 00Z
source share