jquery - Image select box instead of text select? -



jquery - Image select box instead of text select? -

im creating theme wordpress , need have selectbox can click , display images select.

currently function have select dropdown list text.

<select id='selectbox'> <option >airplane</option> <option >bowling</option> <option >alarm</option> </select>

but need have kind of select list images , no text. possible ? assume include jquery work. im unable find answers on net.

ok have spent whole day create work guess im stupid. on every possible illustration , solution have problems making work.

here entire code of metabox utilize http://pastebin.com/1kvyz8mg it's wordpress theme , else works needed, thing can't if replace select box kind of images list select proper image field.

try this:

jquery:

$("#selectbox").change(function(){ var selectedindex = $("#selectbox")[0].selectedindex; $('ul#images li').each(function(index) { if ( index === selectedindex ) { $(this).show(); } else { $(this).hide(); } }); });

html:

<select id="selectbox"> <option >airplane</option> <option >bowling</option> <option >alarm</option> </select> <ul id="images"> <li><img src="sample1.jpg" /></li> <li><img src="sample2.jpg" /></li> <li><img src="sample3.jpg" /></li> </ul>

jquery wordpress select dropdownbox

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

Hibernate criteria by a list of natural ids -

ios - Lagging ScrollView with UIWebview inside -