Possible Duplicate:
How to convert <select> dropdown into an unordered list using jquery?
I want to convert all select dropdowns into ul lists for printing.
<select>
<option>Item 1</option>
<option>Item 2</option>
<option>Item 3</option>
</select>
into:
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
Why does this only show?:
<ul></ul>
jquery:
$('select').parent().append('<ul></ul>');
$('select option').each(function(){
$('<ul>').append('<li>'+$(this).text()+'</li>');
});
$('select').remove();
edit: removed select ID. I want to step through each and not just one particular select.