What is wrong with this javascript?

Posted by bala3569 on Stack Overflow See other posts from Stack Overflow or by bala3569
Published on 2010-04-19T07:06:45Z Indexed on 2010/04/19 7:13 UTC
Read the original article Hit count: 191

Filed under:
|
|

i use this javascript syntax for validating a checkbox...

 alert(document.getElementById("ctl00_ContentPlaceHolder1_Chkreg").checked);
  if (document.getElementById("ctl00_ContentPlaceHolder1_Chkreg").checked == false) {
        document.getElementById("ctl00_ContentPlaceHolder1_ErrorMsg").innerHTML = "please select the checkbox";
        document.getElementById("ctl00_ContentPlaceHolder1_Chkreg").focus();
        return false;
    }

My alert showed me false but my if loop is not working... Any suggestion...

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about checkbox