snipt

Ctrl+h for KB shortcuts

JavaScript

exhibitb

1
2
3
4
5
$('#exhibitb').bind('textchange', function (event, previousText) {
  $('#output').append('<p>Text changed from <strong>' + 
    previousText + '</strong> to <strong>' + $(this).val() + 
    '</strong> </p>');
});
https://snipt.net/embed/8ebd2cf661571b465f78a1f67e8652ee/
/raw/8ebd2cf661571b465f78a1f67e8652ee/
8ebd2cf661571b465f78a1f67e8652ee
js
JavaScript
5
2019-07-22T12:56:33
True
False
False
/api/public/snipt/15321/
exhibitb
<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;#exhibitb&#39;</span><span class="p">).</span><span class="nx">bind</span><span class="p">(</span><span class="s1">&#39;textchange&#39;</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">event</span><span class="p">,</span> <span class="nx">previousText</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="s1">&#39;#output&#39;</span><span class="p">).</span><span class="nx">append</span><span class="p">(</span><span class="s1">&#39;&lt;p&gt;Text changed from &lt;strong&gt;&#39;</span> <span class="o">+</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">previousText</span> <span class="o">+</span> <span class="s1">&#39;&lt;/strong&gt; to &lt;strong&gt;&#39;</span> <span class="o">+</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">val</span><span class="p">()</span> <span class="o">+</span> </span><span id="L-4"><a name="L-4"></a> <span class="s1">&#39;&lt;/strong&gt; &lt;/p&gt;&#39;</span><span class="p">);</span> </span><span id="L-5"><a name="L-5"></a><span class="p">});</span> </span></pre></div> </td></tr></table>
js