snipt

Ctrl+h for KB shortcuts

JavaScript

Google Toolbar conflict

1
2
3
$("input.remove_title").attr("title", "");

http://docs.jquery.com/Plugins/Validation/Reference#Fields_with_complex_names_.28brackets.2C_dots.29
https://snipt.net/embed/b1bcb64e30da03119eb5ac118a4d4530/
/raw/b1bcb64e30da03119eb5ac118a4d4530/
b1bcb64e30da03119eb5ac118a4d4530
js
JavaScript
4
2019-06-01T04:25:30
True
False
False
/api/public/snipt/2496/
google-toolbar-conflict
<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></span><span id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">(</span><span class="s2">&quot;input.remove_title&quot;</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s2">&quot;title&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">);</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="nx">http</span><span class="o">:</span><span class="c1">//docs.jquery.com/Plugins/Validation/Reference#Fields_with_complex_names_.28brackets.2C_dots.29</span> </span></pre></div> </td></tr></table>
jquery

JavaScript

a quick jQuery solution for stripping XHTML tags from a string, except for a specific tag

1
2
3
4
5
$('.sanitize').each(function() {
    $(this).html(
        $(this).html().replace(/\<\/?[^p ]{1,2}[^>]*>/ig,'')
    )
});
https://snipt.net/embed/ef6abc08bd74ef9c7f5970ac2da27b87/
/raw/ef6abc08bd74ef9c7f5970ac2da27b87/
ef6abc08bd74ef9c7f5970ac2da27b87
js
JavaScript
5
2019-05-17T14:45:58
True
False
False
/api/public/snipt/2343/
a-quick-jquery-solution-for-stripping-xhtml-tags-from-a-string-except-for-a-specific-tag
<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></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="s1">&#39;.sanitize&#39;</span><span class="p">).</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">html</span><span class="p">(</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">html</span><span class="p">().</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/\&lt;\/?[^p ]{1,2}[^&gt;]*&gt;/ig</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">)</span> </span><span id="L-4"><a name="L-4"></a> <span class="p">)</span> </span><span id="L-5"><a name="L-5"></a><span class="p">});</span> </span></pre></div> </td></tr></table>
jquery

JavaScript

jquery re-select previous object

1
2
3
4
$('#something')
    .css('display','block')
    .end()
    .html('bob')
https://snipt.net/embed/5bf126784ca69aff274414707a817a00/
/raw/5bf126784ca69aff274414707a817a00/
5bf126784ca69aff274414707a817a00
js
JavaScript
4
2019-06-01T02:04:25
True
False
False
/api/public/snipt/1844/
jquery-re-select-previous-object
<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></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="s1">&#39;#something&#39;</span><span class="p">)</span> </span><span id="L-2"><a name="L-2"></a> <span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s1">&#39;display&#39;</span><span class="p">,</span><span class="s1">&#39;block&#39;</span><span class="p">)</span> </span><span id="L-3"><a name="L-3"></a> <span class="p">.</span><span class="nx">end</span><span class="p">()</span> </span><span id="L-4"><a name="L-4"></a> <span class="p">.</span><span class="nx">html</span><span class="p">(</span><span class="s1">&#39;bob&#39;</span><span class="p">)</span> </span></pre></div> </td></tr></table>
jquery

JavaScript

jQuery Interpreter Bookmarklet

javascript:(function()%20{head%20=%20document.getElementsByTagName(%27head%27)[0];jash_script%20=%20document.createElement(%27script%27);jash_script.src%20=%20%27http://www.billyreisinger.com/jash/source/latest/Jash.js%27;jash_script.type%20=%20%27text/javascript%27;jquery_script%20=%20document.createElement(%27script%27);jquery_script.src%20=%20%27http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.js%27;jquery_script.type%20=%20%27text/javascript%27;head.appendChild(jquery_script);head.appendChild(jash_script);})();
https://snipt.net/embed/f4ffd940ab5e4c09f83d06ba093f715f/
/raw/f4ffd940ab5e4c09f83d06ba093f715f/
f4ffd940ab5e4c09f83d06ba093f715f
js
JavaScript
1
2019-06-18T13:14:05
True
False
False
/api/public/snipt/1778/
jquery-interpreter-bookmarklet
<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">javascript</span><span class="o">:</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span><span class="o">%</span><span class="mi">20</span><span class="p">{</span><span class="nx">head</span><span class="o">%</span><span class="mi">20</span><span class="o">=%</span><span class="mi">20</span><span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByTagName</span><span class="p">(</span><span class="o">%</span><span class="mi">27</span><span class="nx">head</span><span class="o">%</span><span class="mi">27</span><span class="p">)[</span><span class="mi">0</span><span class="p">];</span><span class="nx">jash_script</span><span class="o">%</span><span class="mi">20</span><span class="o">=%</span><span class="mi">20</span><span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="o">%</span><span class="mi">27</span><span class="nx">script</span><span class="o">%</span><span class="mi">27</span><span class="p">);</span><span class="nx">jash_script</span><span class="p">.</span><span class="nx">src</span><span class="o">%</span><span class="mi">20</span><span class="o">=%</span><span class="mi">20</span><span class="o">%</span><span class="mi">27</span><span class="nx">http</span><span class="o">:</span><span class="c1">//www.billyreisinger.com/jash/source/latest/Jash.js%27;jash_script.type%20=%20%27text/javascript%27;jquery_script%20=%20document.createElement(%27script%27);jquery_script.src%20=%20%27http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.js%27;jquery_script.type%20=%20%27text/javascript%27;head.appendChild(jquery_script);head.appendChild(jash_script);})();</span> </span></pre></div> </td></tr></table>
bookmarklet, interpreter, javascript, jquery

JavaScript

Gets all URLs that matchs a pattern using firebug console and jQuery

1
2
3
4
5
6
7
var pattern = /^\/noticia/;
jQuery('a').each(function () {
	var href = jQuery(this).attr('href');
	if (href != undefined && href.match(pattern)) {
		console.log(href);
	}
})
https://snipt.net/embed/0fd1cd5ee9838872f709ce4e6a4c5083/
/raw/0fd1cd5ee9838872f709ce4e6a4c5083/
0fd1cd5ee9838872f709ce4e6a4c5083
js
JavaScript
7
2019-06-15T18:00:59
True
False
False
/api/public/snipt/1247/
gets-all-urls-that-matchs-a-pattern-using-firefox-console-and-jquery
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kd">var</span> <span class="nx">pattern</span> <span class="o">=</span> <span class="sr">/^\/noticia/</span><span class="p">;</span> </span><span id="L-2"><a name="L-2"></a><span class="nx">jQuery</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">).</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="kd">var</span> <span class="nx">href</span> <span class="o">=</span> <span class="nx">jQuery</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">&#39;href&#39;</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">if</span> <span class="p">(</span><span class="nx">href</span> <span class="o">!=</span> <span class="kc">undefined</span> <span class="o">&amp;&amp;</span> <span class="nx">href</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="nx">pattern</span><span class="p">))</span> <span class="p">{</span> </span><span id="L-5"><a name="L-5"></a> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">href</span><span class="p">);</span> </span><span id="L-6"><a name="L-6"></a> <span class="p">}</span> </span><span id="L-7"><a name="L-7"></a><span class="p">})</span> </span></pre></div> </td></tr></table>
firebug, jquery