Switch to full style
JQuery Examples
Post a reply

Check-Uncheck checkbox button using JQuery

Mon Jan 07, 2013 10:14 pm

Check-Uncheck- check if it is checked for checkbox button using JQuery
javascript code
<html>
<head>
<title>Check-Uncheck checkbox button using JQuery</title>

<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<style type="text/css">
body
{
background:#4366AF;
font-size:19px;
}

</style>

<script>
$(document).ready(function(){
$("input#sbtButton").click(function(){
var currentValue= $('input[name=doAgree]').attr('checked');
$('input[name=doAgree]').attr('checked', !currentValue);
// You can add any logic such as if condition etc..
});
});
</script>

</head>
<body>
<form action="#" method="post">

<b>Do you agree on the new policy:</b><input type="checkbox" name="doAgree" /><br/>

<input type="button" value="check-uncheck" id="sbtButton" />
</form>

<div id="div1"></div>
</body>
</html>




Post a reply
  Related Posts  to : Check-Uncheck checkbox button using JQuery
 selection of checkbox in buttongroup in netbeans     -  
 Convert link and button to custom button with good style     -  
 Check DNS error     -  
 check if domain name is taken by php     -  
 check if number is odd or even     -  
 check empty number     -  
 check keyboard events using C++     -  
 check if file exists     -  
 check folder content using asp     -  
 check array contains a value using javascript     -