wispas Posted February 8, 2011 Share Posted February 8, 2011 I want to set up a Javascript Function with a OnClick without the use of a form. Heres a simple Checkbox: <input type="checkbox" name="checker" id="checker" /> Check the button is clicked. <br /> <br /> <a href="#" onclick="meClick()">Submit This</a> I want to add a function to see if checkbox is checked upon clicking the link: <script type="text/javascript"> function meClick(){ if(document.checker.checked == true){ alert("Hooray... checkbox is clicked"); }else{ alert("Nah... its not working"); } } </script> But this is not working... please help... been driving me mad for hours!!!! Quote Link to comment https://forums.phpfreaks.com/topic/227092-validate-checkbox-without-a-form-please-help/ Share on other sites More sharing options...
wispas Posted February 8, 2011 Author Share Posted February 8, 2011 Got it no worries! Quote Link to comment https://forums.phpfreaks.com/topic/227092-validate-checkbox-without-a-form-please-help/#findComment-1171556 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.