usually is't workaround by this
[].forEach.call(list, function() {...});
but one can also use:
or you can have such a nice construction
$(selector).attr(anAttr, condition ? value : null);
$.makeArray(list).forEach(function() {...});
2) function attr can do more - removing attribute as well
it meas that
attr('xxx') -> removeAttr('xxx')
2) function attr can do more - removing attribute as well
it meas that
attr('xxx') -> removeAttr('xxx')
or you can have such a nice construction
$(selector).attr(anAttr, condition ? value : null);
3) jQuery.type() instead of typeof
Full article link: http://www.sitepoint.com/5-little-known-details-jquery-methods/
No comments:
Post a Comment