snipt

Ctrl+h for KB shortcuts

JavaScript

Create an empty element

// This is identical to $("<div></div>") and $("<div/>")
$("<div>");
https://snipt.net/embed/53c45d6cde9027465d5a11e7e6be1315/
/raw/53c45d6cde9027465d5a11e7e6be1315/
53c45d6cde9027465d5a11e7e6be1315
js
JavaScript
2
2019-07-10T05:59:35
True
False
False
/api/public/snipt/11040/
create-an-empty-element
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">// This is identical to $(&quot;&lt;div&gt;&lt;/div&gt;&quot;) and $(&quot;&lt;div/&gt;&quot;)</span> </span><span id="L-2"><a name="L-2"></a><span class="nx">$</span><span class="p">(</span><span class="s2">&quot;&lt;div&gt;&quot;</span><span class="p">);</span> </span></pre></div> </td></tr></table>
jquery

JavaScript

Remove the conflict with other libraries

jQuery.noConflict();
https://snipt.net/embed/04a94ecbcc05a9a8c9435496839ad303/
/raw/04a94ecbcc05a9a8c9435496839ad303/
04a94ecbcc05a9a8c9435496839ad303
js
JavaScript
1
2019-07-14T18:24:46
True
False
False
/api/public/snipt/11035/
remove-the-conflict-with-other-libraries
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">jQuery</span><span class="p">.</span><span class="nx">noConflict</span><span class="p">();</span> </span></pre></div> </td></tr></table>
jquery

JavaScript

Create DOM elements

$("<p>Hi there!</p>")
https://snipt.net/embed/c838d2ea3ce342fd4535277562d90715/
/raw/c838d2ea3ce342fd4535277562d90715/
c838d2ea3ce342fd4535277562d90715
js
JavaScript
1
2019-07-16T09:16:58
True
False
False
/api/public/snipt/11029/
create-dom-elements
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">(</span><span class="s2">&quot;&lt;p&gt;Hi there!&lt;/p&gt;&quot;</span><span class="p">)</span> </span></pre></div> </td></tr></table>
jquery