Saturday, 15 February 2014

javascript - How to capture the value from a drop down list created using - tags -



javascript - How to capture the value from a drop down list created using <ul> <li> tags -

i have drop downwards list having country names flag images. since cannot create such list using <select> <option> tags, created using <ul> <li>. want capture value selected user , utilize other purpose. how can it?

this how list has been created:

<form id="formid" action="" method="post" class="loginform"> <fieldset id="localeselect"> <div> <div id="localeindicator"> <a href="#" title="select country"> <span class="united-kingdom"></span>uk &ndash; english language </a> </div> <ul class="no-bullets block-list" role="tablist"> <li><a href="#"><span class="austria"></span>austria</a></li> </ul> </div> </fieldset> <fieldset> <input type="hidden" name="locale" /> <input type="submit" value="continue" /> </fieldset>

you can this.have @ fiddle

fiddle link

it give idea.

$("#submit").click(function() { alert("the selected value "+ $("ul").find(".selected").data("value")); });

javascript jquery html css

No comments:

Post a Comment