title: Creating DOM elements in jQuery
body: <p>Let's say we have the following JavaScript/jQuery code below</p>
  
  <pre><code>function createElement(i, value) {
      return $('&lt;div&gt;', { id: "field" + i, text: value});
  }
  </code></pre>
  
  <p>I have a div with an id of "container" and then I do:</p>
  
  <pre><code>var c=$("container");
  c.append(createElement(1, "hello, world!");
  </code></pre>
  
  <p>Now I've got 2 questions</p>
  
  <ol>
  <li><p>Does the createElement function use jQuery to return an HTML string that gets appended to container or does it dynamically create a DOM element that gets appended to the container?</p></li>
  <li><p>I'm unfamiliar with this kind of jQuery where you actually create the HTML string (or DOM element) via the $() selector. I tried looking for the documentation on this subject in jQuery's website but I couldn't find it. Can somebody point me in the right direction?</p></li>
  </ol>