Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • 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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(