Skip to content

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

@lcognat

Description

@lcognat

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions