In HTML, delete_icon
is an image class in which if I click it, the email id gets deleted without any confirmation message. I want to add a popup to display when delete_icon
is clicked. The popup mentioned above should open and if yes
is clicked, the instance should get deleted, otherwise it should return the same. How can I achieve this in jQuery
or JavaScript
?
You can better use as follows
<a href="url_to_delete" onclick="return confirm('Are you sure want to dele');">Delete</a>
Hmm. You do this with simple javascript.
<script type="text/javascript">
function deleteImage(x){
var conf = confirm("Are you sure you want to delete this image?");
if(conf == true){
alert("OK... you chose to proceed with deletion of "+x);
}
}
</script>
Using the default browser confirmation box. And this is the example use of the function.
<input name="myBtn" type="button" onClick="deleteImage('images/pic.jpg')" value="Delete Image">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With