DekGenius.com
JAVASCRIPT
jquery set checkbox checked
//jQuery 1.6+ use
$('.checkbox').prop('checked', true);
//jQuery 1.5.x and below use
$('.checkbox').attr('checked', true);
jquery set checkbox checked unchecked
//jQuery 1.6+ use
$('.checkbox').prop('checked', true); //false for uncheck
//jQuery 1.5.x and below use
$('.checkbox').attr('checked', true); //false for uncheck
jquery checkbox set checked
//For jQuery 1.6 and above
$('#myCheckBoxID').prop('checked', true);
//For jQuery Before 1.6
$('#myCheckBoxID').attr('checked','checked');
jquery set checkbox checked
<script>
//jQuery 1.6+ use
$('#checkbox').prop('checked', true);
//jQuery 1.5.x and below use
$('#checkbox').attr('checked', true);
</script>
set checkbox checked jquery
$("#checkboxid").prop('checked', true); // Checks the box
$("#checkboxid").prop('checked', false); // Unchecks the box
get unchecked checkbox jquery
if ($("#check_box_id").is(':checked')) {
alert("checked");
}else{
alert("unchecked");
}
set checkbox checked jquery
$("#checkboxid").attr('checked', true);
jquery checkbox unchecked
$("input:radio[name='NAME']:radio[value='VALUE']").attr("checked",true);
$("input:radio[name='NAME']").removeAttr("checked");
checkbox set checked jquery
check / unchecked a checkbox with jQuery
<html>
<head>
<title>jQuery check / uncheck a check box example</title>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
</head>
<body>
<h1>jQuery check / uncheck a check box example</h1>
<script type="text/javascript">
$(document).ready(function(){
$("#isCheck").click(function () {
alert($('input:checkbox[name=checkme]').is(':checked'));
});
$("#checkIt").click(function () {
$('input:checkbox[name=checkme]').attr('checked',true);
});
$("#UnCheckIt").click(function () {
$('input:checkbox[name=checkme]').attr('checked',false);
});
});
</script>
</head><body>
<input type="checkbox" name="checkme">Check Me</input>
<br/>
<br/>
<br/>
<input type='button' value='Is Check' id='isCheck'>
<input type='button' value='Check It' id='checkIt'>
<input type='button' value='UnCheck It' id='UnCheckIt'>
</body>
</html>
how to get checked and unchecked checkbox value in jquery
$('#submit').click(function(){
var redval = $('.red').val();
var grenval = $('.green').val();
$('.showCheckedValue').text(redval+'&'+grenval );
});
© 2022 Copyright:
DekGenius.com