<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>namespace on Curtis Timson</title><link>https://hugo.curtiscode.dev/tags/namespace/</link><description>Recent content in namespace on Curtis Timson</description><generator>Hugo -- gohugo.io</generator><language>en-GB</language><lastBuildDate>Mon, 05 May 2014 00:00:00 +0000</lastBuildDate><atom:link href="https://hugo.curtiscode.dev/tags/namespace/index.xml" rel="self" type="application/rss+xml"/><item><title>Namespacing jQuery event handlers</title><link>https://hugo.curtiscode.dev/post/jquery/namespacing-jquery-event-handlers/</link><pubDate>Mon, 05 May 2014 00:00:00 +0000</pubDate><guid>https://hugo.curtiscode.dev/post/jquery/namespacing-jquery-event-handlers/</guid><description>If we are to attach 2 or more event handlers to an element these will become stacked and run linear in the order they were attached.
For example:
$(&amp;#34;.foo&amp;#34;).on(&amp;#34;click&amp;#34;, function(e){ console.log(&amp;#34;bar&amp;#34;); }); $(&amp;#34;.foo&amp;#34;).on(&amp;#34;click&amp;#34;, function(e){ console.log(&amp;#34;baz&amp;#34;); }); If .foo is then clicked, the browser console will log:
&amp;#34;bar&amp;#34; &amp;#34;baz&amp;#34; If we wish to remove these event handlers we can call:
$(&amp;#34;.foo&amp;#34;).off(&amp;#34;click&amp;#34;); Simple.
However, what if we wish to only remove 1 of these event handlers and retain the other?</description></item></channel></rss>