In this post we will discuss how we can check if checkbox is checked or not using jQuery in asp.net.
For this particular example, I have added an input check box and a button, and on the button click we are going to display if the checkbox is checked or not.
Also you can read:
- How to remove particular element from an array using JavaScript in asp.net?
- Data Binding and Graphics in WPF
- WCF tutorial and example in C#.Net
Below is the full code.
Once you click on the button, you can see it will display checked if the checkbox is checked.
For this particular example, I have added an input check box and a button, and on the button click we are going to display if the checkbox is checked or not.
Also you can read:
- How to remove particular element from an array using JavaScript in asp.net?
- Data Binding and Graphics in WPF
- WCF tutorial and example in C#.Net
Below is the full code.
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function
() {
$("#btnClick").on("click", function () {
if
(document.getElementById('isCheckBox').checked)
{
alert('Checked')
} else
{
alert('Unchecked')
}
});
});
</script>
<br />
<div class="row">
<div class="col-md-4">
<input
type="checkbox"
id="isCheckBox"/> I Agree<br
/>
<input
type="button"
id="btnClick" value="Click
Here" /><br />
</div>
</div>Once you click on the button, you can see it will display checked if the checkbox is checked.