(2) understanding JQuery

JQuery is a very good JS library. First we have to distinguish the difference between JS and JQuery objects and objects of mutual conversion between them.

(. 1) is the object JQuery produced after packaging by JQuery DOM object, such as $ ( 'html'). Html ().

(2) Jquery subject is unable to use any method of DOM objects, i.e. between the object method JQuery JS and not spliced ​​used interchangeably.

JS objects and objects can be transformed into each other JQuery

(1) JQuery DOM object converted to:

var $ = Cr $ ( "# Cr"); // JQuery objects 
var Cr = Cr $ [0];      // the DOM objects
var $ = Cr $ ( "# Cr"); // JQuery objects 
var Cr cr.get = $ (0);      // the DOM objects

(2) DOM object into the object to JQuery

var cr = document.getElementById("cr");
var $cr = $(cr);   //JQuery对象

 

Guess you like

Origin www.cnblogs.com/0422hao/p/11789949.html
Recommended