javascript - Keypress not working in IE (Keydown and Keyup posting the form) -


i working in form. in have used validate plugin show validation messages. if user press enter key, have validate form , show if name exists.

$('#name').bind("keypress", function (e) {     $("#valid_name").parent("span").removeclass("has-error");     $("#valid_name").text("");     if (e.keycode == 13) {         e.preventdefault();         validate();         return false;     } }); 

this code woking fine in chrome , firefox. need clear validation message shown manually without using plugin. event not triggering in ie. if use keydown/keyup form posted without showing validation message. hence duplicate names added in portal.

can suggest fix issue ??

use e.preventdefault() outside if condition.


Comments

Popular posts from this blog

Redirect to a HTTPS version using .htaccess -

Unlimited choices in BASH case statement -

javascript - jQuery: Add class depending on URL in the best way -