I’m working with the following code and I’m trying to modify the html of some table data. However, the value of $(this).html() seems to always be undefined. I don’t understand why. Could someone explain please.
$(document).on('click',"td",function() {
//console.log($(this).html());
}).focusout(function(){
console.log($(this).html()); //undifined
});
You are binding an event to the document, then getting it’s html. The document doesn’t have html.
What you probably want is this: