$ itself is an alias for the jQuery "class", therefore $() constructs a new jQuery object.
find() function allows you to research the descendants of already selected elements.
each iterates over all the elements applied to selected class or ID and do the further processing.
$() aka jQuery(), is basically an implementation of the Factory
Pattern, in which one object is responsible for the creation of other
objects. Of course, it also follows the Prototype pattern; given that
JS is a prototypal language and that the $()/jQuery() function extends
itself into the new object that is created.
More generally, the term factory method is often used to refer to any method whose main purpose is creation of objects. Factory methods are common in toolkits and frameworks where library code needs to create objects of types which may be subclassed by applications using the framework.
$('#faq').find('dd').hide().end().find('dt').click(function()
Here end will cancel the first find and second find will start from scratch.
jQuery.fn is a shortcut for jQuery.prototype
function($) {
} .. here $ refers to jQuery object...
http://simonwillison.net/2007/Aug/15/jquery/
Difference between
$().bind('click',fn) and $().click(fn)
Two difference:
bind can attach multiple function event to function name in a single statement.
something like this: $("(DIV ID)").bind("mouseout focus", function(){
});
Bind can also attach the custom events with any UI element.
No comments:
Post a Comment