1

I am using this code to add popup confirmation window on action button through jquery code

<script>
jQuery(document).ready(function($) {
$("table.shop_table.subscription_details a.cancel").on("click", function(e) {
    var doit = confirm("Are you sure you want to do it ?")
    if (!doit) {
        e.preventDefault()
    }
})
})
</script>

I am trying to figure out way to customize it so i can change the name of cancel and ok button.

Mr.Devops
  • 301
  • 2
  • 12

1 Answers1

0

I think this will help you:

https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.4/jquery-confirm.min.js

Just do

<a href="somepage" class="confirm">Link to page</a>

And jquery

$(".confirm").confirm();

For more options see: https://craftpip.github.io/jquery-confirm/

Bernhard Beatus
  • 1,191
  • 1
  • 5
  • 6
  • its different from what i am asking actually! code above is already created, i need to add additional option of customizing the buttons text – Mr.Devops Jun 15 '21 at 23:15
  • I think this is not possible, because the confirm element is not rendered in the DOM. You have to do it with jquery confirm js oder with jquery ui dialog. – Bernhard Beatus Jun 16 '21 at 16:39