Multiple JQuery Plugin Instances In Ajax-loaded Html
I am using multiple Blueimp File Upload plugins in ajax-loaded html : $('.edit').click(function(){ $( '#details' ).show(); $('#details div').html(ajax_spinner).load(script.
Solution 1:
Add a callback function to your load
call, and then initialize your form.
$('#details div').html(ajax_spinner).load(script.php, "parameters", function() {
$('#upload').fileupload({ ... });
});
When you use a jQuery selector, like $('#upload'), those elements have to already exist. The upload form doesn't exist until after it's been loaded, so that selector returns empty until after the load finishes.
The reason the alert works
$(document).on('click', '#drop a', function() {
alert('Ah, this works');
});
is due to event delegation. Read more here: http://learn.jquery.com/events/event-delegation/
Post a Comment for "Multiple JQuery Plugin Instances In Ajax-loaded Html"