jQuery .html() vs .text() produce different result in .hover() function

Posted by Paddy on Stack Overflow See other posts from Stack Overflow or by Paddy
Published on 2010-12-24T08:10:43Z Indexed on 2011/01/10 8:53 UTC
Read the original article Hit count: 132

Filed under:

I have a issue where in I am using the .hover() function. If I use .text() fuction to add the html (anchor tag) which I am dynamically creating, it works fine, both the functions are called as desired. But when I use the .html() function instead then the second fuction of .hover() is never been called.

var i = 0;      
textItems = new Array();    
////I am putting the value into textItems using the jquery ajax call  
////and i get its value from a .each() function.  

//.text() implementation  
$('#textArea-id').hover(  
        function() {  
            $('#textArea-id').text(textItems[i]);   
        },  
        function() {  
            //-->mouseout function is called here  
        }  
    );  

//.html() implementation  
$('#textArea-id').hover(  
        function() {  
            $('#textArea-id').html(textItems[i]);  
        },  
        function() {  
            //-->mouseout function is never been called  
        }  
    );  

© Stack Overflow or respective owner

Related posts about jQuery