javascript - Change a form select from multiple to flat dynamically -


i using plugin in wordpress (taxonomy-picker) allow me search multiple taxonomies.

i want change 2 of items "multiple" flat type have dynamically.

so right have example:

<select name="bebida[]" multiple=""><option value="bebida=tp-all">todos</option><option value="bebida=batidos" class="parent">batidos</option><option value="bebida=cervezas" class="parent">cervezas</option><option value="bebida=cervezas-importacion" class="parent">cervezas importaciĆ³n</option><option value="bebida=cocktail" class="parent">cocktail</option><option value="bebida=copas" class="parent">copas</option><option value="bebida=copas-premium" class="parent">copas premium</option><option value="bebida=gin-tonic" class="parent">gin tonic</option><option value="bebida=licores" class="parent">licores</option><option value="bebida=vinos" class="parent">vinos</option><option value="bebida=zumos" class="parent">zumos</option></select> 

that created dynamically , want delete multiple="" attribute in order make them flat of selects have "name" not class.

is posible this??

also not sure of how can add different class attributes want.

so want know how can add class name want , delete multiple attr selects want dynamically.

so example want like:

"if select name "bebida[]" add class "bebida" , delete attribute multiple" , "if select name "ambiente[] add class "ambiente" (but no delete anything)."

i trying delete multiple selector looks not working:

$("select[name='localizacion[]']").removeattr('multiple');

thank much.

  • edited more information

wordpress ships jquery, (inside document.ready):

$('select').each(function() {   if ( $(this).attr('name') == "bebida[]" && $(this).attr('class') == "bebida" ) {     $(this).removeattr('multiple');   } }); 

syntax isn't dead on, idea.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -