Html – How to make a jQuery alert confirm box with “yes” and “no”


How can I make jQuery work with my HTML and CSS? I need when I click on the button and open an alert box in the centre with some text and options "yes" , "no" and when click yes to delete the text.

My code is here:

<div class="text">Some text here
    <a href="#" class="deleteMe">
        <span class="delete-icon"> x Delete </span>


Best Answer

See the following snippet:

$(document).on("click", "a.deleteText", function() {
    if (confirm('Are you sure ?')) {
<script src=""></script>
<div class="container">
    <span class="text">some text</span>
    <a href="#" class="deleteText"><span class="delete-icon"> x Delete </span></a>

Related Question