Skip to content

Instantly share code, notes, and snippets.

@jbatchelor
Created March 15, 2013 14:25
Show Gist options
  • Save jbatchelor/5170210 to your computer and use it in GitHub Desktop.
Save jbatchelor/5170210 to your computer and use it in GitHub Desktop.
Trigger native mobile select list with a button click.
Nifty trick for using a native mobile select list but triggering it with a button click:
Given:
<div class="box">
<i class="my-icon"/>
<select class="multi" multiple="true">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</div>
It can be styled thus:
.box {
position:relative;
}
.box select {
position:absolute;
top:0;
left:0;
width:50px; // this is arbitrary ... choose a size that fits in your box
height:50px; // ditto to width
opacity:0; // makes the native box disappear, but doesn't remove it from the document flow
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment