Getting instance of dynamically loaded content
Hi,
Can't find an answer to this anywhere on the web...
Say I have a container:
- <div id="xxx" class="parent_container">
- ...
- </div>
And a script like:
- <script type="text/javascript">
- $(document).ready(function(){
- $('#xxx').load('http://dynamic.content');
- });
- </script>
This loads the required content into the container and exectutes the javascript found inside dynamic content - great! My problem is: how do I get a jquery reference to loaded element from within dynamic content itself?
What I want to do is something like:
- $(this).parents('.parent_container').remove();
if I use $(this) inside the document.ready() function within dynamic content, it will give me a document object. What I want is a reference to the content that is being inserted.
I don't know the ID of the element from within dynamic content scope.
thanks,
Karolis