Using JQuery Dialog http://jqueryui.com/dialog/#modal-confirmation The dialog box appears whenever the page loads I only want it to appear when 'Remove Invoice' is clicked.
i've tried:<input id="RemoveInvoice" type="button" value="Remove Invoice" onclick="ConfirmDeleteInvoice()" />
then putting the actual JS inside a ConfirmDeleteInvoice function:
function ConfirmDeleteInvoice() {
// $(function () { //removed this line and added the above line
$("#dialog-confirm").dialog({
resizable: false,
height: 140,
modal: true,
buttons: {
"Are you sure you want to delete this invoice": function () {
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
});
}
ERROR: JavaScript runtime error: 'ConfirmDeleteInvoice' is undefined
Sorry still a beginner at JS so please bear with. Thanks
$('#RemoveInvoice').on('click', function(){});and put everything from ConfirmDeleteInvoice inside that anonymous function and remove the onclick from the element.ConfirmDeleteInvoice()function inside of a click handler.. btw i dont know if you pasted the code in but your it has some extra brackets