I want to show confimration box to user, after user clicks on a button.
I am willing to use jquery here.
here is my demo code
<span class="DeleteAction">
<i class='fa fa-remove'></i>
<span>
Yes you can do it simply, using jquery code below
$(document).on('click', '.DeleteAction', function () {
var c = confirm("Are you sure do you want to delete it");
if (c == true) {
//do something here
}
else
{
return false
}
});
You can have this HTML
<span id="delete-button">Delete</span>
JS
<script>
$("#delBtn").click(function(){
if(confirm("Are you sure you want to delete this?")){
// do something here.
}
else{
return false;
}
});
</script>
This should work, thanks
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly