[jQuery] problem with selectors and ajax content
Hi,
I have an HTML document, that I write into a div element. this works
fine, yet when I try to access the the inserted elements via jQuery
selectors I cant.
here the main html document, the div where I input the html document
via jquery respectively
<div id='thesView'>empty</div>
here the html (database.html) document I insert:
<div class='left'>eins</div>
<div class='left'>zwei</div>
<div class='left'>drei</div>
and here my javascript, the part that is commented out does work.. I
can add events to the ajax content, yet $('#thesView > div') does
not.. do I overlook something here???
thx a lot
test = {
dRoot : null,
load : function(){
var oThis = this;
$('#thesView').load('database.html', '', oThis.afterLoad());
},
afterLoad : function(){
this.addBehaviour()
},
addBehaviour : function(){
$('#thesView > div').click(function(){
alert('click')
})
// $('div').click(function(){
// alert('this works!!!!!')
// })
}
}
jQuery(function() {
test.load()
}