jQuery: How do I make a manipulation dependant on the DOM prior to insertion, relative to the insert
- by Evan Carroll
I want to make it so that I .append() to a value based on the status of some other element relative to the place I'm inserting into the dom. What I really want is a trigger that fires after the element has been inserted.
$("#foo").append(
$('<div />').load( function () {
if ( $(this).find('.foo') {
$(this).append( "<span>foobar</span>" )
}
} )
);