Possible Duplicate:
How to detect new element creation in jQuery?
I have a page, which has several divs that are created by a different jQuery call. Once these divs are created, I want to make an ajax call to load some html into them. I have tried something like this (coffeescript):
$("#myDiv").ready ->
alert "div ready"
but because the .ready function is only defined for a document, this runs immediately upon page load (before the div exists). I also tried this:
$("#splunk_results").ready ->
$("#splunk_results").each ->
alert "div ready"
as per the selected answer here, but this seems to not load at all.
Basically, is there a simple way to execute code when a div appears?