html element content change event
<p>i need to known event of content change my div element, how can i do it with jquery?</p>

<pre><code>&lt;div id="mydiv"&gt;text before&lt;/div&gt;
</code></pre>

<p>after some time</p>

<pre><code>&lt;div id="mydiv&gt;other content&lt;/div&gt;
</code></pre>

<p>i do such way</p>

<pre><code>$("#mydiv").change(function() { alert('yes'); });
</code></pre>

<p>by doesn't work</p>

<pre><code>    (function(){

            var interval;

        jQuery.event.special.contentchange = {
            setup: function(data, namespaces) {
                    var $this = $(this);
                var $originalContent = $this.text();
                interval = setInterval(function(){
                    if($originalContent != $this.text()) {
                            console.log('content changed');
                            $originalContent = $this.text();
                            jQuery.event.special.contentchange.handler();
                    }
                },500);
            },
            teardown: function(namespaces){
                clearInterval(interval);
            },
            handler: function(namespaces) {
                jQuery.event.handle.apply(this, arguments)
            }
        };

    })();

$("#mydiv").bind("contentchange", function() {
   alert('yes'); ///no alert! why?
});
</code></pre>

<p>but i see logs in console!</p>
