How to get Checkbox checked value using jQuery
In this article I am going to explain How to get Check box checked value using jQuery.
In this article I am going to explain How to get Checkbox checked value using jQuery.
Just drag and drop one checkbox and button controls to your asp.net web page.
When use click the "Check box value" button, the alert message is displayed to the user.
The following method is used to attached the click event to the button.
$("#btnCheckedState").click(function(){...}Full Code
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Checkbox Checked State using jQuery</title>
<script type="text/javascript" src="jquery-1.2.6.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#btnCheckedState").click(function(){
var isChecked = $('#CheckBox1').attr('checked')?true:false;
alert(isChecked);
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:CheckBox ID="CheckBox1" runat="server" />
<asp:Button ID="btnCheckedState" runat="server" Text="Checkbox Value" />
</div>
</form>
</body>
</html>