Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
148
rated 0 times [  149] [ 1]  / answers: 1 / hits: 18839  / 13 Years ago, tue, may 24, 2011, 12:00:00

I've implemented a form which needs to disable certain options in a select box using Javascript. It works fine in all browsers but not in Safari on IOS (Desktop Safari does it right).



I've been looking around the web but it seems nobody had this problem so far, so I'm unsure whether it is a Safari IOS limitation or something I'm overlooking.



Thanks for any help,
Miguel


More From » ios

 Answers
11

There is no alternative but to remove the disabled options when developing for iOS.



For iPhone the picture is very clear: all select list are styled as click wheels in all circumstances, and these wheels do not accept disabled options. This is shown in the iPhone Simulator as well as on the actual iPhone.



For iPad, the picture is more confusing. The iPad simulator does grey out the disabled options and really makes them disabled, just as mobile Safari and desktop Safari do. But an actual iPad (iPad 1, running iOS 4.2.1, in my case) will show you the click wheel.



So do something like this early on in your script:



// check for ios device
nP = navigator.platform;
if (nP == iPad || nP == iPhone || nP == iPod || nP == iPhone Simulator || nP == iPad Simulator){
$('select option[disabled]').remove();
}

[#92084] Monday, May 23, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
trayvon

Total Points: 35
Total Questions: 117
Total Answers: 88

Location: Guernsey
Member since Tue, Jul 6, 2021
3 Years ago
;