4

I wrote small function. When i type something in input (text input) and then click on this input, all text highlights, so user can delete long text, without typing backspace many times.

$('.search').mouseup(function(){
    var save_this = $(this);
    save_this.select();
    save_this.setSelectionRange(0, 9999);
});

This works well for android and desktop, but not for IOS. Any ideas ?

Here i see, that on IOS while on click from, or to, text is selected.

user3573535
  • 545
  • 2
  • 7
  • 29
  • possible duplicate of http://stackoverflow.com/questions/1269722/selecting-text-on-focus-using-jquery-not-working-in-safari-and-chrome – Regis Portalez May 09 '16 at 13:42

1 Answers1

2

I think you should listen to touchend event on mobile devices instead of mouseup.

István
  • 5,057
  • 10
  • 38
  • 67