javascript - SelectBoxIt only works on first instance of class -


i using selectboxit style selects , works fine if used id's them if use classes, although styles them ok, of options affect first element class.

i trying when form submitted selects reset first 1 does.

i have tried using jquery reset element

$("input[name=positioning]").val($("input[name=positioning] option:first").val()); 

but reset orignal select hiding beneath styled version value showing not value selected.

i've tried...

$(".exposure, .patient, .equip, .unit, .taken, .pathology, .pathway").selectboxit('selectoption', 0); 

only targets first element

$(".exposure").selectboxit('selectoption', 0); $(".patient").selectboxit('selectoption', 0); 

again targets first element

$(".exposure, .patient, .equip, .unit, .taken, .pathology, .pathway").each(function(){         selectboxit('selectoption', 0); }); 

doesn't work @ error selectboxit not defined

everything works expected when using id's problem on 1 of pages intend use on there multiple instances of form in slider have use classes.

i tried using too...

$(".positioning").data("selectbox-selectboxit").selectoption(0); 

this allow me target more 1 class each class had targeted separately again work on first instance of each class.

in end had append element class using unique id each form had (taken php while loop used create slider) each select on page had unique class (so didn't matter if used id's instead of classes either)

<form id="<?=$form_id?>">     <select class="positioning_<?=$form_id?>">     //rest of select here </form>  var form_id = 'form_id' $(".positioning_"+form_id).data("selectbox-selectboxit").selectoption(0); 

not solution hoping works


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -