Jump to content

Check if checkbox has been checked?


kanala

Recommended Posts

How would I check if a check box has been checked. The name of the form is "return" and the name of the checkbox is "agree".Is this how you do it?

function checkme() {if(document.forms['return'].Agree == null){alert('Please read the policies and tick the checkbox');return false;}else{return true;}}
Link to comment
Share on other sites

<script type="text/javascript">  function checkBox(check) {	if (check) {	  alert("Yes");	}	else {	  alert("No");	}  }</script><input type="checkbox" onclick="checkBox(this.checked)">

But the problem with onclick is that once you uncheck the box, it will still work. I need to know how you can find out if the box is checked.
Link to comment
Share on other sites

But the problem with onclick is that once you uncheck the box, it will still work. I need to know how you can find out if the box is checked.
Sorry but it works now, it'e because I wrote == false but it only works when you do ==false (no space).Thanks
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...