Compared to jquery into the DOM, more of the development is the processing of a DOM object into a jquery object. $ (parameter) is a versatile method that produces different effects by passing different parameters.
If the argument passed to the $ (DOM) function is a DOM object, the jquery method wraps the DOM object into a new jquery object.
After the normal DOM object is processed into a jquery object through the $ (DOM) method, we can invoke the jquery method.
HTML code
< Div > Element One </div><Div> element two </ Div > < Div > Elements three </div>
JavaScript code
var div=document.getelementsbytagname (' div '); // DOM Object var $div =$ (DIV); // jquery Object var $first = $div. Frist (); // find the first DIV element $first. css (' Color ', ' red '); // set the color of the first element
The getelementsbytagname gets the element to the DIV node, and the result is a DOM-collection object, but this object is a set of number combinations (3 div elements). The $ (div) method is used to convert the jquery object by invoking the first and CSS methods in the JQuery object to find and change its color.
Dom objects into jquery objects