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
Post a Comment