javascript - show options in select tag when a specific option is selected in other select tag from json -
i have 3 select tags in html document , , when select 1st option 1st select tag, want show other options in second select tag hidden, need load options external file json. how can ?
for e.x have object
var object = { usa: { californina: ['san fransisco', 'san diego' ],nevada: ['las vegas', 'reno'] } }
when select usa option in 1st select tag, want show states (california,nevada) in second select box, , when choose nevada option want show city(las vegas, reno) in 3d select tag!
i want options kept in external json file! how can load json file?
having json this: {"resource":"a","literals":["b","c","d"]} , taking account want read external json file, can follow different answers post: how read external local json file in javascript.
after read information need, can or append options your(s) select(s) (what best way add options select array jquery?) or replace option , append again(how remove , replace select options using jquery?)
probably, want add events after user select option. that, use post jquery select change event selected option
i hope you, best regards
Comments
Post a Comment