$.browser () function, I hope I have not called the wrong. The purpose is: To determine the browser type, return Boolen value
$ (function () {
if ($.browser.msie) {
Alert ("This is an IE browser");}
else if ($.browser.opera) {
Alert ("This is an opera browser");}
})
When page loading determines browser type, there are several types of browsers that can be judged by MSIE, Mozilla, Opera, Safari
$.each (obj, fn) http://www.mlybyby.com
Obj is an object or an array, and FN is the function executed sequentially on OBJ, noting the distinction of $ (). each ()
$.each ([0,1,2], function (i) {alert ("Item #" + i + ":" + This);});
The 0,1,2 is passed into function (i), respectively, as a parameter.
$.each ({name: "John", Lang: "JS"}, function (i) {alert ("Name:" + i + ", Value:" + this);
{Name: "John", Lang: "JS"} is a hash object, in turn, each group of objects in the hash is passed into the function
$.extend (obj, prop)
Extend the first object with a second object
var settings = {validate:false, limit:5, Name: "foo"};
var options = {validate:true, name: "Bar"};
$.extend (settings, options);
After execution, the settings object is {validate:true, limit:5, Name: "Bar"}
You can use the following function to test
$ (function () {
var settings = {validate:false, limit:5, Name: "foo"};
var options = {validate:true, name: "Bar"};
$.extend (settings, options);
$.each (settings, function (i) {alert (i + "=" + This);});
})
$.grep (ARRAY,FN)
By using the function FN to filter the array, passing the elements in the array to FN,FN must return a boolen, such as FN returns True, will be filtered
$ (function () {
var arr= $.grep ([0,1,2,3,4], function (i) {return i > 2;});
$.each (arr, function (i) {alert (i);});
})
We can look at the execution $.grep after the array [0,1,2,3,4] becomes [0,1]
$.merge (first, second)
The two parameters are arrays, the second array is the same as the first one, then the two numbers are combined and
$ (function () {
var arr = $.merge ([0,1,2], [2,3,4])
$.each (arr, function (i) {alert (i);});
})
You can see that the result of ARR is [0,1,2,3,4]
$.trim (str)
Remove spaces at both ends of a string
$.trim ("Hello, how is You?")
The result is "Hello, how is it?"
JavaScript handling of the jquery user manual