title: password validation through javascript
body: <h2>    fields in form ,password  , repeat_password</h2>
  
  <pre><code>            &lt;?php echo  form_open('logincontroller/register',array('onsubmit'=&gt;'return validate_registeration()'));?&gt;
  function validate_registeration(){
  
      var  error_flag = 0;
  
      var  password = $("#password").val();
      var repeat_password = $("#repeat_password").val();
  
      if(password == ''){
        $("#password").addClass('error');
        error_flag = 1; 
      }
      if(password.length &lt;6 &amp;&amp; password !== ''){
        $("#password").addClass('error');
        error_flag = 1;
        $("#msgBox").text("password must be atleast six character"); 
      }
  
      if(repeat_password == ''){
        $("#repeat_password").addClass('error');
        error_flag = 1; 
      }
  
      if(password !==repeat_password){
        $("#repeat_password").addClass('error');
        error_flag = 1; 
        $("#msgBox").text("Password does'nt match");
      }
  
    if(repeat_password !== password){
      $("#repeat_password").addClass('error');
      error_flag = 1; 
      $("#msgBox").text("Password does'nt match");
    }
  
      if(error_flag == 1){
        return false;
      }else{
        return true;
      }
  
    }
  </code></pre>
  
  <p>this is code it don't show me message on password length less than six and dos'nt show password matching message if password dose not match.</p>