Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When you look at the <a href="http://api.jquery.com/jQuery/" rel="nofollow">jQuery documentation</a> you will see some explanation concerning creating new elements with <code>$()</code> function. There is one particular paragraph which sheds some light on the issue here:</p> <blockquote> <p>When passing in complex HTML, some browsers may not generate a DOM that exactly replicates the HTML source provided. As mentioned, we use the browser's .innerHTML property to parse the passed HTML and insert it into the current document. During this process, some browsers filter out certain elements such as <code>&lt;html&gt;</code>, <code>&lt;title&gt;</code>, or <code>&lt;head&gt;</code> elements. As a result, the elements inserted may not be representative of the original string passed.</p> </blockquote> <p>It looks like you may not be able to correctly create some basic elements. Above the quoted paragraph you can read about how the string is parsed and created.</p> <p>I was able to create nodes on Chrome 22 with the following way:</p> <pre><code>var node = document.createElement('html'); node.innerHTML = "&lt;head&gt;&lt;title&gt;Test me&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;div&gt;&lt;p&gt;Test 2&lt;/p&gt;&lt;/div&gt;&lt;/body&gt;" </code></pre> <p>That created entire DOM node and puting this to jQuery constructor allowed me to build valid jQuery object, so:</p> <pre><code>var nodeElem = $(node); nodeElem.find('title'); //get 1 result </code></pre> <p>This was done on Chrome 22 but the result may vary depending on the browser.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload