Dynamic dependent select menus jQuery PHP version -



Dynamic dependent select menus jQuery PHP version -

in previous question made dynamic dependent select menus posted illustration code: http://jsfiddle.net/bs5db/50/. html version of particular jquery script. user @jsweazy helped me pointing should update jquery.uniform script every time select new state first menu. working version of illustration here: http://jsfiddle.net/bs5db/53/. know default alternative big menu fixed....

my problem utilize php version of script. in version updating jquery.uniform $.uniform.update(); doesnt trick. sec menu isnt visible anymore when insert update command.

the php version following...

$(document).ready(function(){ function populate() { if($('#state').val() == 'ak' || $('#state').val() == 'dc') // alaska , district columbia have no counties { $('#county_drop_down').hide(); $('#no_county_drop_down').show(); } else { fetch.dopost('../getcounties.php'); } } $('#state').change(populate); var fetch = function() { var counties = $('#county'); homecoming { dopost: function(src) { $('#loading_county_drop_down').show(); // show loading... $('#county_drop_down').hide(); // hide drop downwards $('#no_county_drop_down').hide(); // hide "no counties" message (if it's case) if (src) $.post(src, { state_code: $('#state').val() }, this.getcounties); else throw new error('no src passed getcounties!'); }, getcounties: function(results) { if (!results) return; var allcounties = $("<option value=\"all\">all counties</option>"); counties.html(results); counties.prepend(allcities); counties.val("all").attr('selected',true); $('#loading_county_drop_down').hide(); // hide loading... $('#county_drop_down').show(); // show drop downwards } } }(); populate(); });

the getcounties.php querying database , retrieves counties of each state works fine. state , county names of 2 select menus. if can give me advice of how accomplish update of counties menu in version of script grateful. thanx in advance taking time read!

i realized in case have update jquery.uniform since there other styled elements such radio buttons, checkboxes etc. have insert $.uniform.update('select').so lastly part of code becomes...

$('#loading_county_drop_down').hide(); // hide loading... $.uniform.update('select') $('#county_drop_down').show(); // show drop downwards

jquery

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -