snipt

Ctrl+h for KB shortcuts

JavaScript+Django/Jinja

jQuery play audio

1
2
3
4
5
$(document).ready(function(){
   $('.button').mouseover(function(){
      $('#btn-noise').get(0).play();
   });
});
https://snipt.net/embed/6662f8b5f6640158c1685e8a5480a619/
/raw/6662f8b5f6640158c1685e8a5480a619/
6662f8b5f6640158c1685e8a5480a619
js+django
JavaScript+Django/Jinja
5
2019-07-21T10:57:47
True
False
False
/api/public/snipt/32859/
jquery-play-audio
<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="nb">document</span><span class="p">).</span><span class="nx">ready</span><span class="p">(</span><span class="kd">function</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="s1">&#39;.button&#39;</span><span class="p">).</span><span class="nx">mouseover</span><span class="p">(</span><span class="kd">function</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="s1">&#39;#btn-noise&#39;</span><span class="p">).</span><span class="nx">get</span><span class="p">(</span><span class="mi">0</span><span class="p">).</span><span class="nx">play</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>
audio, javascript