HTML:
<td>
<input type="checkbox" name="lit" value="literary"><span class="checkdata"> Literary Event </span>
<input type="checkbox" name="art" value="art"><span class="checkdata"> Art Event </span>
<input type="checkbox" name="cul" value="cultural"><span class="checkdata"> Cultural Event </span>
</td>
Script:
<script>
$(function(){
if ("input:checked") {
$(".checkdata").css("color", "#F0F0F0");
}
});
</script>
What I'm trying to do here is to check, if the user has checked the checkbox. If so, the span class="checkdata"
should turn grey. It does not happen though.
this.checked
instead of$(this).checked
? – anubhav gupta Feb 01 '13 at 08:18