title: JQuery: Dynamically create select Tag
body: <p>I am using JQuery to dynamically (based on user choice) create  tag. User enters require options in a text box and my code creates select tag of it. 
  Script is:</p>
  
  <pre><code>var numbersString = "1,2,3,4,5,6";
  var data = numbersString.split(',');
  
  var s = $("&lt;select id=\"selectId\" name=\"selectName\" /&gt;");
  for(var val in data) {
      $("&lt;option /&gt;", {value: val, text: data[val]}).appendTo(s);
  }
  s.appendTo("#msj_form");
  </code></pre>
  
  <p>where msj_form is my div id where the  tag appends.
  Right now it creates:</p>
  
  <pre><code>&lt;select id="selectId" anme="selectName"&gt;
      &lt;option value="0"&gt;1&lt;/option&gt;
      &lt;option value="1"&gt;2&lt;/option&gt;
      &lt;option value="2"&gt;3&lt;/option&gt;
      &lt;option value="3"&gt;4&lt;/option&gt;
      &lt;option value="4"&gt;5&lt;/option&gt;
      &lt;option value="5"&gt;6&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>But I also want to concatinate a Label and <code>&lt;tr&gt;&lt;td&gt;</code> code along with  tag
  such that the code will look like:</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td&gt;My Label&lt;/td&gt;
      &lt;td&gt;
          &lt;select id="selectId" anme="selectName"&gt;
              &lt;option value="0"&gt;1&lt;/option&gt;
              &lt;option value="1"&gt;2&lt;/option&gt;
              &lt;option value="2"&gt;3&lt;/option&gt;
              &lt;option value="3"&gt;4&lt;/option&gt;
              &lt;option value="4"&gt;5&lt;/option&gt;
              &lt;option value="5"&gt;6&lt;/option&gt;
          &lt;/select&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/7DDLn.gif" alt="enter image description here"></p>