jQuery not working in AJAX loaded DIVs

TuttyMan

New Member
In the HEAD of my document I load jQuery.js and also the blockUI jQuery plugin.In the PHP I then use regular AJAX to load other PHP content into DIVs. In the original PHP jQuery and blockUI plugin work just fine, but in any of the ajax-loaded divs jQuery and blockUI both do absolutely nothing. No console error, no warning - nothing.I am a jQuery beginner and none of the other articles I found on this subject were able to put me over the edge of solving this, so I'm helping someone else can. In my code below you'll see I took some stabs at live()...This is at the top of my PHP file that is loaded into the DIV\[code\] <script type="text/javascript"> $(document).ready(function() { $('#crazy').live('click',function() { $.blockUI({ message: $('#question'), css: { width: '275px' } }); }); $('#yes').live('click',function() { // update the block message $.blockUI({ message: "<h1>Remote call in progress...</h1>" }); $.ajax({ url: 'wait.php', cache: false, complete: function() { // unblock when remote call returns $.unblockUI(); } }); }); $('#no').live('click',function() { $.unblockUI(); return false; }); }); </script> \[/code\]Here is the HTML from that PHP file (loaded into the DIV):\[code\]<input id="crazy" type="submit" value="http://stackoverflow.com/questions/3796799/Show Dialog" /> <div id="question" style="display:none; cursor: default"> <h1>Would you like to contine?.</h1> <input type="button" id="yes" value="http://stackoverflow.com/questions/3796799/Yes" /> <input type="button" id="no" value="http://stackoverflow.com/questions/3796799/No" /> </div> \[/code\]
 
Back
Top