snipt

Ctrl+h for KB shortcuts

JavaScript

Make any DIV a link

<div onclick="location.href='http://www.example.com';" style="cursor:pointer;"></div>
https://snipt.net/embed/b6e9051441eff650ef906084a4f39932/
/raw/b6e9051441eff650ef906084a4f39932/
b6e9051441eff650ef906084a4f39932
js
JavaScript
1
2019-08-23T07:29:20
True
False
False
/api/public/snipt/3786/
make-any-div-a-link
<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="o">&lt;</span><span class="nx">div</span> <span class="nx">onclick</span><span class="o">=</span><span class="s2">&quot;location.href=&#39;http://www.example.com&#39;;&quot;</span> <span class="nx">style</span><span class="o">=</span><span class="s2">&quot;cursor:pointer;&quot;</span><span class="o">&gt;&lt;</span><span class="err">/div&gt;</span> </span></pre></div> </td></tr></table>
div, javascript, link