Skip to content Skip to sidebar Skip to footer

Fire Event Before 'focus' Kicks In / Fire Event Before Keyboard Appears On Ios

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',

Solution 1:

Try touchstart Event

$(document).on('touchstart', 'textarea', function() {
console.log("touchstart event");
  });

Solution 2:

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

Post a Comment for "Fire Event Before 'focus' Kicks In / Fire Event Before Keyboard Appears On Ios"