Link to home
Start Free TrialLog in
Avatar of sbornstein2
sbornstein2

asked on

JQuery/MVC simple question creating button click through JQuery

Hello all,

I have a function that inserts a button after another button.  I need the class to call a click event of the button I am creating.  The class is using a button style.  This works on another area outside of the JQuery.  So here is what I have below.  The delete-button click event function is not getting into it the way I have this.   The onEdit function actually uses a Kendo editor template that places the delete button on the editor popup.  I think it may be based on the href not being correct.   Thanks all

  function onEditCollateral(e) {
        if (e.model.isNew()) {
            updateBtnText = $(".k-grid-update").html().replace("Update", "Create");
            $(".k-grid-update").html(updateBtnText);
            return;
        }
        
        $('<a class="delete-button k-button" href="\\\#"><span class="k-icon k-delete"></span>Delete</a>').insertAfter(".k-grid-update");
    }


    $(".delete-button").click(function(e) {
        e.preventDefault();
        alert('got this');
        var kendoWindow = $("<div />").kendoWindow({
            title: "Confirm",
            resizable: false,
            modal: true
        });

        kendoWindow.data("kendoWindow")
            .content($("#delete-confirmation").html())
            .center().open();

        kendoWindow
            .find(".delete-confirm,.delete-cancel")
            .click(function() {
                if ($(this).hasClass("delete-confirm")) {
                    $('<input />').attr('type', 'hidden')
                        .attr('name', 'cmdName')
                        .attr('value', 'Delete')
                        .appendTo('#LoanForm');

                    $("#LoanForm").submit();
                }

                kendoWindow.data("kendoWindow").close();
            })
            .end();
    });

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sbornstein2
sbornstein2

ASKER

this is perfect thank you.   Do you know how I can call an action method in a controller passing a parameter I have in my model.  The param is model.loanid
thanks