If the checkbox is checked, then I need to show an Alert, in Jquery.
Try this:
Html
<table> <tr> <td><input type="checkbox" class="test_checkbox" value="1" />Value 1</td> </tr> <tr> <td><input type="checkbox" class="test_checkbox" value="2" />Value 2</td> </tr> </table>
Jquery
<script type="text/javascript"> $(document).ready(function(){ //Example 1 $('.test_checkbox').click(function(){ if ($(this).attr('checked')) { alert("Checked - Value:"+$(this).attr('value')); }else{ alert("Unchecked - Value:"+$(this).attr('value')); } }); //Example 2 $(".test_checkbox").click(function(){ var thisCheck = $(this); if(thisCheck.is(':checked')) { alert("Checked - Value:"+$(this).attr('value')); }else{ alert("Unchecked - Value:"+$(this).attr('value'));s } }); }); </script>
Try this:
Html
Jquery