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>
$(function(){
if ("input:checked") {
$(".checkdata").css("color", "#F0F0F0");
}
});
</script>
我在这里要做的是检查用户是否选中了复选框。如果是这样,span class="checkdata"
应该变成灰色。但它不会发生。