Jquery Replace Select Options -
this question has answer here:
- how change options of <select> jquery? 7 answers
 
i looking replace current select options set of option without using loop. have block of code:
<select> <option>o1</option> <option>o1</option> </select>   i have variable:
$newoptions = "<option>newo1</option>                <option>newo1</option>";   and want swap inside of select state new options. no loop needed.
<select>     $newoptions </select>   is there way using jquery?
$('selectoptions[name='+fldname+']').replacewith(newoptions);   thank you.
try way:
<select id='needselect'>   <option>o1</option>   <option>o1</option> </select>  $newoptions = "<option>newo1</option>                <option>newo1</option>";  $('select#needselect').html($newoptions);      
Comments
Post a Comment