I am trying to stop the focusout(blur)
event when i click submit for a textinput
.
I just dont want the textinput
to lose focus and stop closing the soft keyboard.
I tried doing this below to avoid the focusout
, but that prevents me closing the keyboard all together when i need to. Any Idea?
textarea.addEventListener("blur", function() {
setTimeout(function() {
textarea.focus();
}, 0);
});
Edit var mousedownHappened = false;
$('input').blur(function() {
if(mousedownHappened) // cancel the blur event
{
alert('stay focused!');
$('input').focus();
mousedownHappened = false;
}
else // blur event is okay
{
// Do stuff...
}
});
$('a').mousedown(function() {
mousedownHappened = true;
});