How to add JS Confirmation popup when clicking an #AJAX button in custom module? $form['button4'] = array(
'#value' =&gt; 'RESET',
'#type' =&gt; 'submit',
'#submit' =&gt; array('form_test_form_button4'),
'#ajax' =&gt; array(
  'callback' =&gt; 'ajax_example_submit_driven_callback1',
    'progress' =&gt; array('type' =&gt; 'none'),
    'wrapper' =&gt; 'deletevalue',
    'event' =&gt; 'click',
),

);


This is the RESET button I want to ask Are you sure?.

AJAX submit also working fine. But POPUP Confirmation not working properly.Please anyone guide to me?

If user click the OK button the data will be reset.

JS

$('#edit-button7').on('click', function(){
var r = confirm("Are you sure you want to reset?");
});

If user click the CANCEL button also data was reset.
I could have sworn it was on so somewhere. But I could not find it quickly. You can try this using the form API in your button. Found here

 '#attributes' =&gt; array('onclick' =&gt; 'if(!confirm("Really Delete?")){return false;}')


You can of course use JS as you were. I think you were missing the return false;