How we can trigger events manually. for example, I want to remove image if greater then specific size.
var imageInputElement = document.querySelector("#kt_image_input_control");
var imageInput = new KTImageInput(imageInputElement);
imageInput.on("kt.imageinput.changed", function(e) {
var files = e.inputElement.files;
var file = files[0];
var size = file.size / 1024 / 1024;
if(size > profile_pic_size_limit) {
toastr.error('El tamaño del archivo no puede ser más de 1mb');
console.log(imageInput)
imageInput.trigger('kt.imageinput.cancel','click');
imageInput.trigger('click','kt.imageinput.cancel');
return;
}
}
For many people this is the best solution here see how to do it.Monaco Luxury Yacht Charter
Understanding trigger events is key. At Popup Balloons, we ensure timely responses to make events memorable.Popup Balloons
Knowing when to act is crucial. We deliver and pick up dumpsters exactly when our customers need them.USA Dumpster Rentals Miami
Thanks for writing such a good article, I stumbled onto your blog and read a few post. I like your style of writing...auto attendant systems here
It is quite beneficial, although think about the facts when it reaches this target.Oviedo Bed Bug Treatment
I wrote about a similar issue, I give you the link to my site. Orlando Pest Control
Your texts on this subject are correct, see how I wrote this site is really very good.Kissimmee Termite Treatment
Hi,
You can trigger it using DOM event trigerring:
imageInput.getElement().query("[data-kt-image-input-action="cancel"]").click();