I am trying to assign a click event to span elements with class 'open' and 'appoint'. But I cannot get it to work. Code is as shown below.
HTML:
<td><span id = "28" class='open'>28</span></td>
<td><span id = "29" class='open'>29</span></td>
<td><span id = "30" class='closed'>30</span></td>
<td><span id = "31" class='appoint'>31</span></td>
<td><span id = "32" class='closed'>32</span></td>
JS:
$("span[class='open'][class='appoint']").click(function() {
alert($(this).html());
});
I have tried below combinations too, but nothing seems to work.
$("span.open.appoint")
$("span .open .appoint")
$("span .open, .appoint")