dsomel21
dsomel21

Reputation: 626

How to hide options in select menu for iOS / iPhones

I am pretty much trying to create a filter menu, where if you select the first filter, it will pre-filter options in the second menu.

It works on Web and Android... the problem is only on iOS... because of the way iPhone's have their select menu. It reveals all of them.

What I was thinking of doing was perhaps adding a disabled attribute to the options that I want hidden, but I wanted a second opinion on that.

Upvotes: 0

Views: 1196

Answers (1)

Stan Fad
Stan Fad

Reputation: 1234

Only this works for me - wrap in <span> element you need to hide. "if-check" is for not wrapping it twice if hiding connected with some action on page, you can freely remove it having just $(this).wrap('<span>').

Hide for iOS with jQuery:

if( !($(this).parent().is('span')) ) $(this).wrap('<span>');

Unhide for iOS with jQuery:

if( ($(this).parent().is('span')) ) $(this).unwrap();

Upvotes: 2

Related Questions