What are you the most excited about in the new versions of jQuery? [closed]
Solution 1:
Believe it or not, the "FINALLY" moment for me was the addition of delay()
:
$("#notice").slideDown('500').delay(4000).slideUp('500'); // = Pure awesome :)
Solution 2:
The ability to create elements on the fly in a more terse manner, by passing all attributes as the second argument to jQuery()
:
jQuery('<div/>', {
id: 'foo',
mouseenter: function() {
// do stuff
},
html: jQuery('<a/>', {
href: 'http://google.com',
click: function() {
// do stuff
}
})
});
All non-attribute properties map to the corresponding jQuery method. So having html
there will call .html()
and having click
will bind a new click
event via .click()
...