Checkbox will not stay checked.
Hello I'm new to jQuery and I find it to be very useful way in upgrading my forms from my website to have more functionality to them. I am having a problem with my checkboxes though. I'm trying to use a check box to show a hidden div and it works good, but when I hit the submit button to do error checking the hidden div is hidden and the check box is unchecked. Here is a sample of the code that I have.
<script type="text/javascript" src="Javascript/jquery-1.4.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//Hide div w/id extra
$("#extra_reg1").css("display","None");
// Add onclick handler to checkbox w/id addmore1
$("#addmore1").click(function(){
// If checked
if ($("#addmore1").is(":checked"))
{
//show the hidden div
$("#extra_reg1").show("slow");
}
else
{
//otherwise, hide it
$("#extra_reg1").hide("slow");
}
});
<form action="harvest_registration.php" method="post">
<input type="checkbox" id="addmore1" tabindex="12" name="addmore1"/>
<div id="extra_reg1">
<p class="grey_italic"><strong>Registrant #2</strong></p></td>
</div>
<input type="submit" name="Submit" id="Submit" value="Submit" tabindex="132" />