I'm in a situation where I need to bind a click event to a span (placed inside an achor having multiple classes) based on the classes applied to it.
For eg:
UPDATE: Added the html eg below
<div class="c0 c">
<a class="c1 c2">
<span class="c3 c4"></span>Anchor_Text
</a>
</div>
Now I'm binding a click event as below:
$('span.c3.c4').click(function (e) { alert("clicked!"); });
The above jQuery code doesnt work. However if I use the classes on anchor to bind the click event, it works. Please see below:
$(.c1').click(function (e) { alert("clicked!"); });
$(.c2').click(function (e) { alert("clicked!"); });
Any help will be appreciated!
UPDATED: Please find the html example updated within the Q now.
Multiple classes should be selected like this:
See a working demo here > http://jsfiddle.net/JeG3A/