0

I'm hoping someone can point me in the right direction. I've searched Google for hours, but may not searching with the correct terminology. What I need is super simple. I need an check box that a user must check before clicking the submit button.

If the check box is checked then it will redirect the user to a specific webpage. My issues is with the java script. I'm not sure how to set the "IF" and "ELSE" statements. If anyone can provide a link or a quick simple example it would be super appreciated.

Thanks in advance.

1 Answers1

1

Try this

if (document.getElementById('checboxid').checked) {
    document.getElementById("buttonid").onclick = function() { 
        window.location.href = 'http://something.com'; 
    };
} else {
   alert("not checked");
}
Don Djoe
  • 705
  • 1
  • 10
  • 21