Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvment : Add a listener to a certain class to create confirmable link #6

Open
lcognat opened this issue Jun 28, 2016 · 0 comments

Comments

@lcognat
Copy link
Contributor

lcognat commented Jun 28, 2016

It would be nice to have a listener to a certain class to create confirmable link:
for example:

<script type="text/javascript">
$('.bootstrap-alert-confirmable').click(function(event){
  var message = $(this).data('message');
  var dest = event.target.href;
  event.preventDefault();
  $.alert({
    text_confirm: 'oui',
    text_decline: "annuler",
    click_outside_for_close: false,
    title: 'Êtes-vous sûr(e) ?',
    body: message + '<br>Êtes-vous sûr(e) ?',
    callback_confirm: function(){
      window.location = dest;
    },
    is_delayed: false,
  });
});
</script>

and in the page (DOM)

<a class="btn btn-danger bootstrap-alert-confirmable" data-message="This will cancel things." href=scheme://path/to/final/link">Cancel</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant