How to get the current object of the appended element
var new_htm = "<div class='engagement_data'>" + htm +"</div>";
$("#addin").append(new_htm);
i want to construct a this for the appended element in jquery how to do this..
How to get the current object of the appended element
var new_htm = "<div class='engagement_data'>" + htm +"</div>";
$("#addin").append(new_htm);
i want to construct a this for the appended element in jquery how to do this..
Try this...
var $new_htm = $("<div class='engagement_data'>" + htm +"</div>").appendTo("#addin");
.appendTo()
returns the object that you append, whereas append()
returns the parent object.
Append the element and than:
$this = $("#addin").find('.engagement_data');
An even better way can bev
$div = $("#addin").append(newHtml).children()