Ok, I got this code:
$(document).ready(
function() {
$(".dialogDiv").dialog({
autoOpen: false,
modal: true,
position: [50, 50],
buttons: {
"Print page": function() {
alert("Print");
},
"Cancel": function() {
$(this).dialog("close");
}
}
}
);
$('.ui-dialog-buttonpane button:contains("Print page")').attr("id", "dialog_print-button");
$(".dialogDiv").parent().appendTo($('form'));
}
How to assign or install a new function for a click event?
$ ("# dialog_print button"). ???
Edit, this works:
$("#dialog_print-button").unbind("click").click(
function () {
alert("new function that overide the old ones")
}
)
Tried to find how to do this in the jQuery documentation, but I find it hard to find it in the documentation. Especially when new to javaScript and jQuery libary.
Change, a quick way to get help is to go to the jQuery irc: D channel
source
share