How to use bootstrap instead of confirm dialog box?

<a href="https://www.baidu.com" onClick="return confirmJump();"><a>
<script>
function confirmJump(){
  $("-sharpjumpModal").modal("toggle");
  return false;
  // 
}
</script>

Update

I have a table that shows no records, and then each record has an action button (delete), which needs to be linked to a url.

<td>
    <a href="/delete/1/" role="button" class="btn btn-danger"></a>
</td>
The id above will change because there are multiple records.

A simple implementation is as follows:

<td>
    <a href="/delete/1/" role="button" class="btn btn-danger" onclick="return confirm("");"></a>
</td>

now I just think that the confirm dialog box doesn"t match my web page style, so I want to replace it with bootstrap"s modal box.

this is a method, but I don"t know if it"s relatively best.

what he does is add the herf attribute of the record I selected to the href attribute of the a tag on modal.

Mar.18,2021

if you have a confirmation button in-sharpjumpModal-button.confirm, you can add the following paragraph:

<script> 
    $('-sharpjumpModal .confirm').click(function(){
        window.open( 'https://www.baidu.com', '_self' )
    });
</script>

you can use the modal box event: hidden.bs.modal this event is triggered after the modal box is hidden (and at the same time the CSS transition effect is complete).


https://stackoverflow.com/que.

reference connection.

Thank you for the warm-hearted people who answered the questions.

@ Fan Jie Qi Jackie
@ passerby

Menu