Wednesday, January 29, 2014

Assigning Multiple Classes For Click Event Using jQuery

I have an click event that I want to assign to more than one class. The reason for this is that I'm using this event on different places in my application, and the buttons you click have different styling in the different places.

I have used following method and it worked for me. You can select multiple classes at once with jQuery like this:
$(".class1, .class2").click(function(){

In this way you can assign more than one class for any event using jQuery.


No comments:

Post a Comment