... and "this" within afterLoad (see http://www.nabble.com/prob-with-tf4411558s15494.html http://www.nabble.com/prob-with-tf4411558s15494.html )
Richard D. Worth-2 wrote: > > Here's where I think the problem is: > > $('#thesView').load('database.html', '', oThis.afterLoad()); > > should be > > $('#thesView').load('database.html', '', oThis.afterLoad); > > Notice the removal of the parans following oThis.afterLoad. This way > you're > passing the name of the function (as a callback), instead of executing the > function and passing its result. With the parans, the function executes > before the dynamic content is loaded so there are no divs under #thesView. > > - Richard > > On 9/8/07, JuergenRiemer <[EMAIL PROTECTED]> wrote: >> >> >> 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() >> } >> >> > > -- View this message in context: http://www.nabble.com/problem-with-selectors-and-ajax-content-tf4411564s15494.html#a12590152 Sent from the JQuery mailing list archive at Nabble.com.