I'm using jquery mobile and within a <form>
i have 'save' and 'edit' buttons (<a>
tags with data-role="button"
). Once the save button is clicked, a dialog/confirmation opens. In this dialog is the usual confirm/cancel options.
What I want to happen is once the 'confirm' is clicked and using data-rel="back"
to go back to the form page, i want the save button to be disabled and the edit button, that was by default disabled, to become enabled.
HTML:
<!--save button--><a class="save_button" data-role="button" href="save.html" data-rel="dialog" data-transition="pop">Save/Enter Line-Up</a>
<!--edit button--><a class="edit_button" data-role="button" href="edit.html" data-rel="dialog" data-transition="pop">Edit Line-Up</a>
(save.html):
<div data-role="content">
<p>Do You Want To Save?</p>
<a class="confirm_button" href="#" data-role="button" data-rel="back">Confirm</a>
<a class="cancel_button" href="#" data-role="button" data-rel="back">Cancel</a>
</div><!-- /content -->
JS:
$(document).ready(function() {
$('.edit_button').addClass('ui-disabled');
/*edit button*/
$('.confirm_button').on("click", function() {
$('.edit_button').removeClass('ui-disabled');
$('.save_button').addClass('ui-disabled');
});
});
I cannot get this to work. The above JS works if I don't leave the page (i.e. if the confirm button was on the same page as the save and edit buttons). But once i open the dialog it doesn't work.
Thanks in advance for any help.