html - jquery highlight input boxes when credentials are wrong when logging in to website -


i'm not sure why can't function correctly in jsfiddle:

http://jsfiddle.net/urvf6/

perhaps it's because post action directing page? maybe it's working because of url change i'm not seeing it?

<script>    $('#loginform').submit(function(){      var vals = $('.nomargin').val()      if (!vals)          {           console.log('error exists');           $('.nomargin').attr('style', "border-radius: 5px; border:#ff0000 1px solid;");           $('.nomargin').val('enter value');         }       return false; });         </script>           <div class="loginbox clearmefocus">                 <form action="client_homepage.dhtml" method="post" name="loginform" id="loginform" >  <input type="hidden" name="site" id="site" value="free">                      <h3>agent log in</h3>                     <div style="float: left; font-size: 10px; color: red; margin-top: -8px; position: absolute;"></div>                     <div class="clearfix">                         <input type="text" name="username" id="username" value="" title="username" class="nomargin">                         <input type="password" name="password" id="password" value="" title="password">                         <input type="image" src="images/submit.png" value="submit" name="submit" id="submit" alt="submit">                     </div>                     <h6><a href="/join.dhtml">not associate?</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/password.html">forgot password?</a></h6>                 </form>             </div> 

any appreciated. thank you.

you returning false outside condition, form never submitted, update follows:

$('#loginform').submit(function(){  var vals = $('.nomargin').val()  if (!vals || vals=="")      {       console.log('error exists');       $('.nomargin').attr('style', "border-radius: 5px; border:#ff0000 1px solid;");       $('.nomargin').val('enter value');         return false;     }   });     

check fiddle


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -