Mon Jan 07, 2013 10:14 pm
<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>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.