I don't know the structure of your data coming from your server, but
generally speaking you should do something like :
var $sel = $('<select name="select_1" class="filter"></select.');
now loop from your array and populate your select 
$sel.append($('<option value="'+ value + '>' + text +'</option>');

once you get your select compete then append it to ul
$('ul#filter').append($sel); 


tdktan...@gmail.com wrote:
> 
> 
> So ive got a fun page where I need to create the dropdowns based on an
> array I pass into the html. (coming form php)
> 
> However I cant figure out how to actually create a select box... I can
> however populate a select box that exists...
> 
> Before Jquery does its stuff
> <ul id="filter"></ul>
> 
> So heres what I need the end to look like after jquery has run its
> stuff
> 
> <ul id="filter">
> <li id="select_1"><select name="select_1" class="filter"><option
> value="1">1</option></select></li>
> <li id="select_2"><select name="select_2" class="filter"><option
> value="1">1</option></select></li>
> </ul>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Create-a-Select-Box-tp24525251s27240p24525842.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to