I have the following PHP loop:
for ($i=0; $i<sizeof($order->products); $i++) {
$id = $order->products[$i]['id'];
...
...
echo '
<div id="piGal_' . $id . '">
<ul id="piList_' . $id . '">
</ul>
<div id="receive_inventory_button_' . $id . '"><button id='RECEIVE INVENTORY' ...></div>
</div>
<div id="add_new_location_' . $id . '">
<a href="#" onclick="addNewPiForm_' . $id . '();return false;">
<span class="ui-icon ui-icon-plus" style="float: left;"></span>ADD NEW</a></div>
<div id="piDelConfirm_' . $id . '" title="Delete This Location?">
<p><span>...</span>Please confirm the removal of this location.</p>
</div>';
...
...
}
And I have the following jQuery code to delete an item with confirm delete button.
var piDelConfirmId_' . $orders_products_id . ' = 0;
jQuery(document).ready(function () {$("#piDelConfirm_' . $id . '").dialog({
autoOpen: false,
resizable: false,
draggable: false,
modal: true,
buttons: {
"DELETE": function() {
$("#piId" + piDelConfirmId_' . $id . ').effect("blind").remove();
$(this).dialog("close");
},
"CANCEL": function() {
$(this).dialog("close");
}
}
});
});
function showPiDelConfirm(piId) {
piDelConfirmId_' . $id . ' = piId;
$('#piDelConfirm_' . $id . '').dialog('open');
}
</script>
This works fine.
Now I want to hide one element and show another element instead, when delete is confirmed. So I add the below 2 lines
$("#receive_inventory_button_' . $id . '").css({"visibility": "hidden", "display": "none"});
$("#add_new_location_' . id . '").css({"visibility": "visible", "display": "block"});
within the
"DELETE": function() {
....
}
This somehow doesn’t work:
buttons: {
"DELETE": function() {
$("#piId" + piDelConfirmId_' . $id . ').effect("blind").remove();
$(this).dialog("close");
$("#receive_inventory_button_' . $id . '").css({"visibility": "hidden", "display": "none"});
$("#add_new_location_' . $id . '").css({"visibility": "visible", "display": "block"});
},
I would much appreciate any help.
Thank you in advance.
Upon clicking on the CONFIRM delete button the dialog box window closes. However, the following 2 lines don’t get executed
$("#receive_inventory_button_' . $id . '").css({"visibility": "hidden", "display": "none"});
$("#add_new_location_' . $id . '").css({"visibility": "visible", "display": "block"});
Edward B. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.