<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" >
$(document).ready(function(){
$( document ).on("click",function(){
if($("input[name='test[]']:checked").val()){
alert($("input[name='test[]']:checked").val());}
});
});
</script>
</head>
<body>
<b> Checkboxes</b><br>
<form id="test_form">
<input type="checkbox" name="test[]" value="Test1">Test1<br>
<input type="checkbox" name="test[]" value="Test2">Test2 <br>
<input type="checkbox" name="test[]" value="Test3">Test3<br>
<input type="checkbox" name="test[]" value="Test4">Test4 <br>
</form>
</body>
</html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" >
$(document).ready(function(){
$( document ).on("click",function(){
if($("input[name='test[]']:checked").val()){
alert($("input[name='test[]']:checked").val());}
});
});
</script>
</head>
<body>
<b> Checkboxes</b><br>
<form id="test_form">
<input type="checkbox" name="test[]" value="Test1">Test1<br>
<input type="checkbox" name="test[]" value="Test2">Test2 <br>
<input type="checkbox" name="test[]" value="Test3">Test3<br>
<input type="checkbox" name="test[]" value="Test4">Test4 <br>
</form>
</body>
</html>
No comments:
Post a Comment