javascript - Dropdown changing value when selected -


i have 5 cities (phil, germany, usa, china , russia) , 5 cities stored database , have 5 dropdown having 5 cities there values.

what want happened this, if user select germany on dropdown 1, germany value on other dropdowns shouldn't exist anymore. meaning, germany remove automatically on options of other dropdown.

can know's how make possible on codeigniter?

at moment have initial code http://screencast.com/t/edtzfhjmon

is there's need use jquery or javascript make happened? thanks

i recommend having 5 of dropdowns generated, , disable first. way people must answer in order.

when first selected, run code, , re-enable next select , remove appropriate option remaining.

<select id="dropone" class="countries">     <option class=".germany">germany</germany>     <option class=".phil">phil</germany>     <option class=".usa">usa</germany>      <option class=".china">china</germany>     <option class=".russia">russia</germany> </select> 

i've added classes representing value in each. then, use jquery hide selected answer option remaining selects:

$('.countries').change(function () {     var val = $(this).find('option:selected').attr('class');     $('.countries:gt('+$(this).index()+')').find('option.'+val).hide(); }); 

Comments

Popular posts from this blog

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

c# - Specify IP End Point in FiddlerCore -

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -