jQuery .html() vs .text() produce different result in .hover() function
- by Paddy
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
}
);