标签:style http color os io width re c
// Returns "lots of extra whitespace"$.trim( " lots of extra whitespace " );
$.each([ "foo", "bar", "baz" ], function( idx, val ) {console.log( "element " + idx + " is " + val );});$.each({ foo: "bar", baz: "bim" }, function( k, v ) {console.log( k + " : " + v );});
var myArray = [ 1, 2, 3, 5 ];if ( $.inArray( 4, myArray ) !== -1 ) {console.log( "found it!" );}
var firstObject = { foo: "bar", a: "b" };var secondObject = { foo: "baz" };var newObject = $.extend( firstObject, secondObject );console.log( firstObject.foo ); // "baz"console.log( newObject.foo ); // "baz"
var firstObject = { foo: "bar", a: "b" };var secondObject = { foo: "baz" };var newObject = $.extend( {}, firstObject, secondObject );console.log( firstObject.foo ); // "bar"console.log( newObject.foo ); // "baz"
var myFunction = function() {console.log( this );};var myObject = {foo: "bar"};myFunction(); // windowvar myProxyFunction = $.proxy( myFunction, myObject );myProxyFunction(); // myObject
var myObject = {myFn: function() {console.log( this );}};$( "#foo" ).click( myObject.myFn ); // HTMLElement #foo$( "#foo" ).click( $.proxy( myObject, "myFn" ) ); // myObject
jQuery核心之那些有效的方法,布布扣,bubuko.com
标签:style http color os io width re c
原文地址:http://www.cnblogs.com/iceseal/p/3868677.html