I am inserting the HTML response from an AJAX call into my page, but then when I try to access those elements after they have been created, it fails..
This is how i retrieve and insert the HTML:
$.ajax({url: 'output.aspx',
data: 'id=5',
type: 'get',
datatype: 'html',
success: function(outData) {$('#my_container').html(outData);}
})
The outcome HTML, which is inserted into the
- milk
- ice cream
- chewing gum
...and afterwards, when I try to access any of the
elements using queries like:$('#my_container li:first') or
$('#my_container ul:first-child') or similar, nothing gets selected.
I am using the Listen plugin to detect any click events on the
elements and it works... But i couldn't figure out how to detect if the div is populated with the output HTML and accordingly change one of the 's class for example...$(document).ready does not work either...
Imagine I need to change the css style of the second
.. what is the solution to this?