How can I re-initialize cropper if I dynamically include path to cropper.js with
Destroy it first, and then initialize again.
After the script reference is loaded into
I'm trying to initialize it, but I get this error that copper is not a function, so there is nothing to destroy and $('#image').cropper returns the errorI guess you loaded a wrong script. Which one you are using?
I was using jquery based cropper and everything was working fine when the link was present in html.
Than new requirement came to load script on button click and it stopped working.
Now I tried JS based cropperjs and was able to use it, just have to re-write some old jquery code now, so I was thinking if it was possible to initialize jquery cropper.
There is no proper example for destroying the cropper session using jquery. In documentation it is written
`destroy()
Destroy the cropper and remove the instance from the image.`
But i don't understand where to write this code
@milpas999 $('img').cropper('destroy')
Hi...
And how destroy cropper using pure javascript?
If you have:
var cropper = new Cropper(image, {...});
Then you can destroy it by writing:
cropper.destroy();
But how to reinit after the destroy?
It is removing the element from the DOM.