0

hi i have this problem.

I want after click to focus input on iphone, with animation and focus input. It works everywhere just only iphones is the problem. thx for everything.

$('.focusOnInput').on('click touchstart', function(e) {
    e.preventDefault();

    $("html, body").animate({
        scrollTop: "0px"
    }, 400, function() {
        setTimeout(function() {
            $("input#focusOnMe").focus();
        }, 100);

    });
});
Alan Larimer
  • 589
  • 8
  • 24
vAhy_The
  • 590
  • 6
  • 10
  • Did a bit of research to discover `focus` functions are ignored by iOS devices - for usability concerns. https://stackoverflow.com/questions/33830187/auto-focus-form-element-on-iphone-ipad - according to this stackoverflow article. Hope this helps! – escapesequence Oct 30 '17 at 14:37
  • i find something similar, but i hope there is some chance to make it :) – vAhy_The Oct 30 '17 at 14:45
  • `focus()` is ignored when it is not a reaction to user's click, as described in answers to https://stackoverflow.com/q/12204571/1235394 – Victor Oct 30 '17 at 15:14
  • thx sorry for duplicate – vAhy_The Nov 02 '17 at 13:50

0 Answers0