I want to fire off an event before my focus on a textarea (i.e. before the keyboard appears on iOS).
Is this possible?
My code to handle the focus is here:
$(document).on('focus', 'textarea', function() {
console.log("focus event");
});
I want to fire off an event before my focus on a textarea (i.e. before the keyboard appears on iOS).
Is this possible?
My code to handle the focus is here:
$(document).on('focus', 'textarea', function() {
console.log("focus event");
});
Try touchstart Event
$(document).on('touchstart', 'textarea', function() {
console.log("touchstart event");
});
I would use the focusin event note that this event catch the child elements focus as well.
focusin: sent before first target element receives focus
$("div").focusin(function(){
$(this).css("background-color", "#FFFFCC");
});
Check here to know more about the focus events order