tags:

views:

95

answers:

1

Hi, S it possible to create a select tag with options in JQuery..

            $("<select id="jSelect">
  <option value="1">String</option>
  <option value="2">Number</option>
  <option value="3">Date</option>
 </select>").appendTo(".menu li")

Does this works ...Its not working for me..Please suggest me ...

+2  A: 

You're using strings wrong. You have double quotes in dubble quoted strings, try this instead, also string in javascript don't span multiple lines.

    $(' <select id="jSelect">'+
            '<option value="1">String</option>'+
           '<option value="2">Number</option>'+
            '<option value="3">Date</option>'+
    '</select>').appendTo(".menu li")
Pim Jager