As of jQuery 1.4, we can now pass an object as the second parameter of the jQuery function. This is helpful when we need to insert new elements into the DOM. For example:
Before
$('')
.attr({
id : 'someId',
className : 'someClass',
href : 'somePath.html'
});
After
$('', {
id : 'someId',
className : 'someClass',
href : 'somePath.html'
});
Not only does this save a few characters, but it also makes for cleaner code. In addition to element attributes, we can even pass jQuery specific attributes and events, like click or text.
