I've been looking for a method of adding a jQuery event to a button which once clicked will fire the event followed by the asp postback.
Adding the event is easy enough the issue however is delaying the asp postback temporarily.
Asp Code (Events added in C#):
<input runat="server" ClientIDMode="static "id="cancelButton">
JQuery Code:
var cancelBtn = jQuery('#cancelButton');
cancelBtn.click(function (e) {
e.preventDefault();
var cancelBtnEvent = cancelBtn[0].click;
jQuery(pnl).animate({
height: 200
}, 300, 'swing', function () {
cancelBtnEvent();
});
});
In the code above I am adding a click event to the button, 'cancelBtn' is an input[type="button"]. The event will stop the defaults, save the click function to call later, do some animation then call the click function. However this fails with the error invalid object call.
So my question:
How should this be done? or Can my solution be fixed?
Thanks
<a>? - A. Wolff