Kali ini saya akan share tentang bagaimana cara membuat konfirmasi sebelum menghapus suatu data dengan javascript sederhana.
Berikut ini syntaxnya.
___________________________________
<script>
function confirmDelete(delUrl) {
if (confirm("Are you sure you want to delete")) {
document.location = delUrl;
}
}
</script>
<a href="javascript:confirmDelete('delete.page?id=1')">Delete</a>
___________________________________
Atau bisa juga seperti ini
___________________________________
<script>
function confirmDelete(delUrl) {
if (confirm("Are you sure you want to delete")) {
document.location = delUrl;
}
}
</script>
<a href="delete.page?id=1" onclick="return confirm('Are you sure you want to delete?')">Delete</a>
___________________________________
Semoga bermanfaat.
http://pangeran-it.blogspot.com/
Konfirmasi Delete Sederhana
Reviewed by Syawaluddin Amin, S.Kom
on
Januari 20, 2014
Rating:
Tidak ada komentar: