I'm using this code to generate a div dynamically:
// my html string :)
var myString = '<id="newDiv"div> hello </div>';
// html decode the string
myString = $("<div />").html(myString).text();
// appending the string
$("#parentDiv").append(myString);
It appends just fine (it shows up on the screen). And also doing $('#newDiv').length correctly shows a value of 1. But then when I try to call remove() on it (or any function) like
$('#newDiv').remove()
nothing happens. What is going on?