I have an click event that I want to assign to more than 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.
What I want is something like $('.tag' '.tag2'), which of course don't work.
$('.tag').click(function (){
if ($(this).hasClass('clickedTag')){
// code here
}
else {
// and here
}
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…