
Untitled
By: a guest on
May 3rd, 2012 | syntax:
None | size: 0.91 KB | hits: 13 | expires: Never
what's the meaning of the way of writing in jquery?
$.each(obj,function(key,value) {})
$('document').ready(function(){}); or $(function(){});
function myFunction() {
alert("This is myFunction");
}
myFunction(); // alerts "This is myFunction"
myFunction.someProperty = "test";
alert(myFunction.someProperty); // alerts "test"
myFunction.someMethod = function() {
alert("This is someMethod");
};
myFunction.someMethod(); // alerts "This is someMethod"
$(function(){});
// is equivalent to my example
myFunction();
$.each();
// is equivalent to my example
myFunction.someMethod();
$(document)
// returns a jQuery object that has a "ready" method so you can say
$(document).ready();
// which is equivalent to
var doc = $(document);
doc.ready();
$('div').hide().fadeIn().fadeOut().show();
$('a')
$.each(...)
$('a').hide();