Tag: The His div Java function adds color traversal test
1.JQ objects are normal objects generated by the JS new object.
2.JQ objects and JS objects, their methods cannot be shared!
3.jq object and JS Object Mutual Transformation:
JS object to JQ object, $ (js_obj);//This way, js_obj can use the JQ method;
$ (js_obj). Click (function () {});
JQ object to JS object->①$ (' div ') [0];//So, the JQ object can use the JS method;
②$ (' div ') get (0);//In this way, the JQ object can use the JS method;
$ (' div ') [0].INNERTHML = "abc";
4.JQ function body the difference between $ (this) and this;
$ (this), on behalf of the JQ object;
This-> represents this Dom object;
$ (' div '). Click (function () {
this.innerhtml = "ABC";
$ (this). HTML (' abc ');
These two methods achieve consistent results, combined with the above 3rd is not difficult to see the principle
})
5.JQ Core Approach
The traversal of each () object (can pass parameter i);
$("img").each(function(i){
this.src = "test" + i + ".jpg";
});
Size () contains the number of JQ objects in the body;
Length property, function ibid.
Get (), obtain the first several JQ objects and convert them to JS objects ;
A.index (b) The index of the->a object in the B object;
Add attributes (JSON format) to the JQ object, data ();
Jq_obj.data ({' Age ', 20})
The difference between 2018-08-26 jquery and JavaScript and the core method