How to use Jcrop() for jquery on DOM generated at the future?
I'm using jcrop for jquery to crop images. To use it, I'm using $(function(){ $('#jcrop').Jcrop(); });.
My problem is that, the target element #jcrop is generated using ajax. So when I use the above code, it doesn't recognized the DOM element.
How do I change the code to mak开发者_如何学编程e it work with .live()??
Delegate is an alternative to the .live() method and is the recommended way to go. Delegate your event to run when dynamic #jcrop element is loaded:
$("body").delegate("#jcrop", "load", function(){
$(this).Jcrop();
});
加载中,请稍侯......
精彩评论