So I have a function in a jsp file that uses a dialog to prompt a confirm or cancel message. I then call this function in another jsp page. This would obviously keep displaying the dialog on the first jsp because of the div tag call. So I thought the best way to display this dialog in both jsp's would be to pass in the div tag from each page into the function.
Question
Is it possible to use a function in one jsp, pass in a div tag from another so that it display on the jsp that the function is called on? And how?
function executeConfirmDelete(nodeUniqueId, pageId) {
$( pageId ).dialog({
buttons: [
{
text: "Confirm",
"class" : "btn btn-primary button-width-medium",
click: function() {
$(this).dialog("close");
deleteLANode(nodeUniqueId);
}
},
{
text: "Cancel",
"class" : "btn btn-default",
click: function() {
$( this ).dialog( "close" );
}
}
]
});
//basic css calls here and msgDialog string.
$(pageId).dialog( "option", "title", "Confirm Delete Link" )
.dialog("open")
.html(msgDialog);
}