snipt

Ctrl+h for KB shortcuts

JavaScript

Get ID in js w/jQuery dom object return

$( document.getElementById("some_id") );
https://snipt.net/embed/a263aa5f5037f8d42f5005eb040cd348/
https://snipt.net/raw/a263aa5f5037f8d42f5005eb040cd348/
a263aa5f5037f8d42f5005eb040cd348
js
JavaScript
1
2016-09-24T02:38:11
True
False
False
Apr 08, 2014 at 09:22 AM
/api/public/snipt/107720/
get-id-in-js-wjquery-dom-object-return
<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 id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">(</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s2">&quot;some_id&quot;</span><span class="p">)</span> <span class="p">);</span> </span></pre></div> </td></tr></table>
element, get, id, jquery, js

JavaScript

Highlight all div elements on page

javascript:var%20eL=document.getElementsByTagName('div');for(i=0;i%3CeL.length;i++)%7Bvoid(eL%5Bi%5D.style.border='solid%201px%20red')%7D
https://snipt.net/embed/421403ebcd22826355affd469c29f583/
https://snipt.net/raw/421403ebcd22826355affd469c29f583/
421403ebcd22826355affd469c29f583
js
JavaScript
1
2016-09-30T16:55:49
True
False
False
/api/public/snipt/14513/
highlight-all-div-elements-on-page-using-a-specified-colour
<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 id="L-1"><a name="L-1"></a><span class="nx">javascript</span><span class="o">:</span><span class="kd">var</span><span class="o">%</span><span class="mi">20</span><span class="nx">eL</span><span class="o">=</span><span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByTagName</span><span class="p">(</span><span class="s1">&#39;div&#39;</span><span class="p">);</span><span class="k">for</span><span class="p">(</span><span class="nx">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span><span class="nx">i</span><span class="o">%</span><span class="mi">3</span><span class="nx">CeL</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span><span class="nx">i</span><span class="o">++</span><span class="p">)</span><span class="o">%</span><span class="mi">7</span><span class="nx">Bvoid</span><span class="p">(</span><span class="nx">eL</span><span class="o">%</span><span class="mi">5</span><span class="nx">Bi</span><span class="o">%</span><span class="mi">5</span><span class="nx">D</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">border</span><span class="o">=</span><span class="s1">&#39;solid%201px%20red&#39;</span><span class="p">)</span><span class="o">%</span><span class="mi">7</span><span class="nx">D</span> </span></pre></div> </td></tr></table>
bookmarklet, display, div, dom, element, favelet, highlight, javascript, js

CSS

make center a element in f?ed way

1
2
3
4
5
6
7
8
     border: red dotted 5px;
     text-align: center;
     position: absolute;
     margin-left: -75px;
     margin-top: -75px;
     left: 50%;
     top: 50%
     display: block;
https://snipt.net/embed/7caa72be4173cfb143a15f020b78b807/
https://snipt.net/raw/7caa72be4173cfb143a15f020b78b807/
7caa72be4173cfb143a15f020b78b807
css
CSS
8
2016-09-22T18:58:19
True
False
False
/api/public/snipt/7317/
make-center-a-element-in-fied-way
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a> <span class="nt">border</span><span class="o">:</span> <span class="nt">red</span> <span class="nt">dotted</span> <span class="nt">5px</span><span class="o">;</span> </span><span id="L-2"><a name="L-2"></a> <span class="nt">text-align</span><span class="o">:</span> <span class="nt">center</span><span class="o">;</span> </span><span id="L-3"><a name="L-3"></a> <span class="nt">position</span><span class="o">:</span> <span class="nt">absolute</span><span class="o">;</span> </span><span id="L-4"><a name="L-4"></a> <span class="nt">margin-left</span><span class="o">:</span> <span class="nt">-75px</span><span class="o">;</span> </span><span id="L-5"><a name="L-5"></a> <span class="nt">margin-top</span><span class="o">:</span> <span class="nt">-75px</span><span class="o">;</span> </span><span id="L-6"><a name="L-6"></a> <span class="nt">left</span><span class="o">:</span> <span class="nt">50</span><span class="o">%;</span> </span><span id="L-7"><a name="L-7"></a> <span class="nt">top</span><span class="o">:</span> <span class="nt">50</span><span class="o">%</span> </span><span id="L-8"><a name="L-8"></a> <span class="nt">display</span><span class="o">:</span> <span class="nt">block</span><span class="o">;</span> </span></pre></div> </td></tr></table>
center, css, element, html

JavaScript

.Code.JavaScript.Tiny.CreateElement.Dc

1
2
3
dc=function(tag){
	return(document.createElement(tag));
}
https://snipt.net/embed/112471269e5b74e95e6d4e334775ed2e/
https://snipt.net/raw/112471269e5b74e95e6d4e334775ed2e/
112471269e5b74e95e6d4e334775ed2e
js
JavaScript
3
2016-09-26T06:56:15
True
False
False
/api/public/snipt/3676/
codejavascripttinycreateelementdc
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nx">dc</span><span class="o">=</span><span class="kd">function</span><span class="p">(</span><span class="nx">tag</span><span class="p">){</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">return</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="nx">tag</span><span class="p">));</span> </span><span id="L-3"><a name="L-3"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
a3lyphe, create, createelement, dc, document, ecma, element, general, javascript, return, short, tag, universal

JavaScript

.Code.JavaScript.Tiny.GetElement.$

1
2
3
$=function(id){
	return(document.getElementById(id.toString()));
}
https://snipt.net/embed/8d4ad096072970dbe92896f8553e9f69/
https://snipt.net/raw/8d4ad096072970dbe92896f8553e9f69/
8d4ad096072970dbe92896f8553e9f69
js
JavaScript
3
2016-09-30T18:00:34
True
False
False
/api/public/snipt/3675/
codejavascripttinygetelement
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="o">=</span><span class="kd">function</span><span class="p">(</span><span class="nx">id</span><span class="p">){</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">return</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="nx">id</span><span class="p">.</span><span class="nx">toString</span><span class="p">()));</span> </span><span id="L-3"><a name="L-3"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
$, a3lyphe, document, dollar, ecma, element, function, general, get, getelementbyid, id, javascript, notstring, short, tiny, tostring, universal
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.