jquery - Cancel an onBlur event in JavaScript? -


i want set onblur event input element validates value and, if invalid, "cancels" blur , refocusses input. returning false onblur not cancel onblur way onclick. there solution (perhaps using jquery?)

i don't know of reliable cross-browser way this. setting small timeout in onblur event , calling focus() when timer fires works.

for example:

document.getelementbyid('your_input_id').onblur = function() {   var self = this;   settimeout(function() { self.focus(); }, 10); } 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -