Metronic Mega Update!Tailwind 4, React 19, Next.js 15, KtUI, ReUI, eCommerce, User Management Apps and more
Explore Update

Trigger events


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;
}
}


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (8)


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();


Regards.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(