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>" )
}
} )
);
In the above example I use .load() as pseudo-code to do what I want -- It doesn't work for me. Here, .load() executes the function and sets $(this) to the element I attached the event too.