Mosh Feu
Mosh Feu

Reputation: 29247

Hide 'option' element in iphone

Here is the html:

<select>
   <option style="display:none;">1</option>
   <option>2</option>
   <option>3</option>
   <option>4</option>
</select>

Here is the result on Chrome - Desktop

Chrome Desktop

And here is the result in iPhone - Safari

iPhone Safari

jsbin

Upvotes: 3

Views: 4416

Answers (1)

Kevin Lynch
Kevin Lynch

Reputation: 24703

You could disable or remove it using jQuery

DEMO http://jsfiddle.net/Fa8Xx/1728/

<select>
   <option class="targetThis">1</option>
   <option>2</option>
   <option>3</option>
   <option>4</option>
</select>

jQuery

function isiPhone(){
    return (
        (navigator.platform.indexOf("iPhone") != -1) ||
        (navigator.platform.indexOf("iPod") != -1)
    );
}
if(isiPhone()){
   $(".targetThis").attr('disabled', true);
}

Upvotes: 1

Related Questions