mardi 24 février 2015

Jquery syntax for "also do this"?

This is possibly an easy question, but do to my lack of eduction in jQuery I don't know the answer. And I'm just curious.


Is it possible to do something like this:



jQuery("a").click(function() {

jQuery(this).siblings().fadeToggle() "and also" .toggleClass("foo");

});


Instead of repeating the first half of it, like this:



jQuery("a").click(function() {

jQuery(this).siblings().fadeToggle();
jQuery(this).siblings().toggleClass("foo");

});




Aucun commentaire:

Enregistrer un commentaire