Search code examples
jqueryinternet-explorerfunctionlive

jQuery live in IE


JS:

var count = 0;

jQuery(function () {
    $('.input').live('input', function () {

    //any instructions here
    count++;
    $('.count').text(count);

    });
});

HTML:

<textarea class="input" /></textarea>

<br /> <span class="count"></span>

I want to do the same in IE. This works in all browsers but not in IE...

I can't use live('keyup') because this must works "on paste".

Also live('paste') doesn't work in IE.

I want to execute instructions when type a character (with keyboard) or paste a character (right click > paste [with mouse]).

http://jsfiddle.net/4LDJG/4/


Solution

  • i use setinterval function

    $(function (){
    
        function jm(){
           var val=$('textarea').val();
           var jj=val.split("");
           $('.count').text(jj.length);
        }
        setInterval(jm,100);
    });