.on and .off not working in jquery
<p>I have attached an click event of span in this way. the span is with in a table.</p>

<pre><code> $("#tblImport").find("span").each(function () {
                $(this).click(function () {
                    appendData(this);
                });
            });
</code></pre>

<p>This event "appendData" makes an ajax request and gets the data.</p>

<pre><code> function appendData(prntSpan) {
            $(prntSpan).append(createElements());//ajax call.
            updateEvents(prntSpan);
        }
</code></pre>

<p>What I want is to detach this click event handler and attach a new one.
So I tried this.</p>

<pre><code>function updateEvents(curntSpan) {
        $(curntSpan).off('click');//this works
        $(curntSpan).off('click', appendData);// but this does not work strange
        $(curntSpan).on('click', toggleData(curntSpan));//nor a new click handler is attached
    }
</code></pre>

<p>The function is called when the above line where .on is used is executed, but afterwards when you click on the span no event is fired.</p>
