Triggering remove event of kendo upload on click of button is not working

Chaitanya

I want to remove selected file of kendo upload control on click event of another button and I followed the below link Triggering OnCancel event of kendo upload on click of button the remove event fired but not clear the file below is my code. please can any one help me what i am doing wrong.

$(document).ready(function () {
        $("#files").kendoUpload({
            "multiple": false,
            select: function (event) {
                console.log(event);
                var notAllowed = false;
                $.each(event.files, function (index, value) {
                    if ((value.extension).toLowerCase() !== '.jpg') {
                        alert("not allowed! only jpg files!");
                        notAllowed = true;
                    }
                    else if (value.size > 3000000) {
                        alert("file size must less than 3MB ");
                        notAllowed = true;
                    }
                    if (event.files.length > 1) {
                        alert("Please select single file.");
                        e.preventDefault();
                    }
                });

                var breakPoint = 0;
                if (notAllowed == true) event.preventDefault();
                var fileReader = new FileReader();
                fileReader.onload = function (event) {

                    var mapImage = event.target.result;
                    $("#sigimage").attr('src', mapImage);
                    document.getElementById("sigimage").style.display = 'block';


                }
                fileReader.readAsDataURL(event.files[0].rawFile);

            },
                remove: function (e) {
                    alert("remove");
                    e.preventDefault();
                },

        });
        $("#closewindow").click(function (e) {
            $("#files").data("kendoUpload").trigger("remove");
        });
    });
Amal Dev

You can use the following code for removing the file inside your click function.

$(".k-delete").parent().click();

Please visit the fiddle here for a working example

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

jquery - Click event not working for dynamically created button

Backbone JS Button Click Event Not Working

Triggering submit button with Enter keypress event and mouse click

Jquery click event not triggering

Bind Click Event to Kendo-UI Button

Triggering a Click on a Button

Timer event is not triggering button click

Button click event not triggering

Kendo button(k-button) is not triggering on click event Jquery

Gtk Button not triggering button release event on left click

triggering button click event in table row with mouseup event

Attach click event to body via button click without immediately triggering it

Kendo UI Button - on click event

Click event not always triggering

Backbone Click Event On Button Not Working

Triggering click event on an element not working in IE8

Triggering FancyBox with click() event

Kendo Grid: Onchange event is not triggering

XAML button not triggering on click?

on click event in javascript not triggering

How to remove click event from "No file chosen" which appears next to file upload button

Execute custom javascript function on refresh button click in of Kendo upload control

Click event not working on dynamically added button or Panel

Plotly Button Click Event not working

Click event not working on button of dynamic generated table

jquery click() not triggering on button

selenium button click not triggering inline javascript event handler

Triggering event click() using document.querySelector() is not working, but triggering CSS event click() from console works ok

Native Javascript click event not working on icon in button