Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12789 closed bug (cantfix)

.SELECT() DOES NOT SELECT INPUT CONTENT ON IPHONE BROWSER

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:

Description

Hi

I'm running Safari and Chrome on Ios 6.0 and this following code doesn't work. It work on normal browser like firefox chrome on PC ...

$("input[id='"+iRow+"_"+"nom_client"+"']","#navgrid").bind('focus',function(){

$(this).select();

});

Change History (7)

comment:1 Changed 6 years ago by dmethvin

Owner: set to anonymous
Status: newpending

doesn't work*

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/. Open the link and click to "Fork" (in the top menu) to get started.

comment:2 in reply to:  1 Changed 6 years ago by barden <barden.q@…>

Ok it's done, here the link : http://jsfiddle.net/5AGCb/

comment:3 Changed 6 years ago by bblackwood

This is actually an issue with mobile safari (not sure about chrome), not with jQuery. I filed a bug with Apple a while ago and they responded that it was intended behavior. There is no public version of bugs submitted to Apple (that I know of), but here was the bug submitted and response received:

A page like the following will select the text inside the input on desktop safari on load:

http://jsfiddle.net/fzDHJ/

On mobile safari, nothing happens. Selection is not visibly affected, but neither is an error raised.

Response from Apple: Engineering has determined that this issue behaves as intended based on the following information:

The selected element in the DOM is indeed updated. But "selecting" something in the sense of showing a cursor and displaying the keyboard requires explicit user interaction on iOS and cannot be done programmatically.

comment:4 Changed 6 years ago by dmethvin

Thanks bblackwood! I just tested this modified test case on Android 2.3.4 (the phone I have handy) and it works correctly. I have incorporated several different events and selection methods to see if it's jQuery doing the dirty or not.

http://jsfiddle.net/5AGCb/4/show

barden, can you run this case and see if any of them select the text? If not this ticket is probably cantfix from our end.

comment:5 Changed 6 years ago by barden <barden.q@…>

Thanks for your answers. Nothing works... I think there is no solution. Maybe in next version of iOS ?

comment:6 Changed 6 years ago by dmethvin

Resolution: cantfix
Status: pendingclosed

comment:7 in reply to:  5 Changed 6 years ago by anonymous

Replying to barden <barden.q@…>:

Thanks for your answers. Nothing works... I think there is no solution. Maybe in next version of iOS ?

What I was able to do was use selectionStart and selectionEnd. It's not pretty, but it might get you what you need.

http://jsfiddle.net/5AGCb/5/

Note: See TracTickets for help on using tickets.