Skip to content Skip to sidebar Skip to footer

Convert Drop-down Into Textbox?

I am trying to convert already populated dropdownlist to a single textbox via javascript or jQuery but cant figure it out! I would like to remove/change The 'Select' to 'td' eleme

Solution 1:

You can loop through each option and create a new TableRow for each option. for each TableRow you can fill in the Value of the option fields. Afterwards you can add the created rows to a table object. Hope this tells you the basic idea. greets

Solution 2:

Here's a fiddle demonstrating what @CyrillC explained: http://jsfiddle.net/pnRQb/

Solution 3:

You can do this

var html = "<input id='stuff' type='textbox' value="
               + $("#stuff option:first").val() +" />";
   $("#stuff").remove();
   $(".mainstuff").append(html);

See the demo on jsFiddle.net

You can tweak it according to your requirement.

Hope this helps you.

Post a Comment for "Convert Drop-down Into Textbox?"