Reputation: 256
i want to call the action() only when the button is clicked. but its not happening :/
$(document).ready(function() {
var window = $("#space"),
undo = $("#button");
undo.bind("click", function() { action(); });
var onClose = function() { undo.show(); };
if (!window.data("kendoWindow")) {
window.kendoWindow({
width: "600px",
title: "Basic Reports ",
close: onClose
});
}
});
Upvotes: 0
Views: 105
Reputation: 2540
You are using jquery so simply use
$("#Your_button_id").click(function(){
// place your coding here
});
Upvotes: 0
Reputation: 3761
You can use on instead of bind:
$("#button").on("click", function() {
action();
});
From the jQuery API documentation:
As of jQuery 1.7, the .on() method is the preferred method for attaching event handlers to a document. For earlier versions, the .bind() method is used for attaching an event handler directly to elements. Handlers are attached to the currently selected elements in the jQuery object, so those elements must exist at the point the call to .bind() occurs. For more flexible event binding, see the discussion of event delegation in .on() or .delegate().
Upvotes: 1
Reputation: 4328
You can simply attach the action function as the event handler like so:
$('#button').click(action);
Upvotes: 3