snipt

Ctrl+h for KB shortcuts

HTML

Clear default input value on click with pure javascript

<input onfocus="if(this.value == 'Search...') this.value = '';" onblur="if(this.value=='') this.value='Search...';" value="Search...">
https://snipt.net/embed/3265fccfbaaf0605e226ce5c374069ce/
https://snipt.net/raw/3265fccfbaaf0605e226ce5c374069ce/
3265fccfbaaf0605e226ce5c374069ce
html
HTML
1
2016-09-23T12:50:01
True
False
False
/api/public/snipt/98159/
clear-default-input-value-on-click-with-pure-javascript
<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="nt">&lt;input</span> <span class="na">onfocus=</span><span class="s">&quot;if(this.value == &#39;Search...&#39;) this.value = &#39;&#39;;&quot;</span> <span class="na">onblur=</span><span class="s">&quot;if(this.value==&#39;&#39;) this.value=&#39;Search...&#39;;&quot;</span> <span class="na">value=</span><span class="s">&quot;Search...&quot;</span><span class="nt">&gt;</span> </span></pre></div> </td></tr></table>
form, input, value

HTML

Get value css right , top , other more..

1
2
3
4
5
6
7
// © 2012-2013, [ Abstract Codify ] Abstractcodify.com All Rights Reserved.

<div class='class' style="right: 10px;"> any more.. </div>

a = parseInt($('.class').css('right'));

// value  "a"  echo  10
https://snipt.net/embed/9a03967e122fafe3231ce3bc3fd94545/
https://snipt.net/raw/9a03967e122fafe3231ce3bc3fd94545/
9a03967e122fafe3231ce3bc3fd94545
html
HTML
7
2016-09-24T18:29:55
True
False
True
Aug 04, 2013 at 11:46 PM
/api/public/snipt/71901/
get-value-css-right-top-other-more
<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 id="L-1"><a name="L-1"></a>// © 2012-2013, [ Abstract Codify ] Abstractcodify.com All Rights Reserved. </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">&#39;class&#39;</span> <span class="na">style=</span><span class="s">&quot;right: 10px;&quot;</span><span class="nt">&gt;</span> any more.. <span class="nt">&lt;/div&gt;</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>a = parseInt($(&#39;.class&#39;).css(&#39;right&#39;)); </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a>// value &quot;a&quot; echo 10 </span></pre></div> </td></tr></table>
css, javascript, value
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.