简体   繁体   中英

New line in Bootbox Alert box

I would like to make a new line in my Bootbox Alert Box. I know in Javascript you can use \\n but this doesn't seem to work. Here is what I have tried:

bootbox.alert("Hello \n world");

You can use html for that:

bootbox.alert("Hello <br> world!");

Will do it

with confirm message

 $(function () { $(".confirm").click(function (e) { e.preventDefault(); bootbox.confirm({ message: "<h3>Hello</h3> <br> world!", buttons: { confirm: { label: 'yes', className: 'btn-success' }, cancel: { label: 'no', className: 'btn-danger' } }, callback: function (result) { if (result) console.log('yes'); } }); }); });
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> <script src="https://code.jquery.com/jquery-1.11.3.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js"></script> <a href="http://www.example.com/" action="deleteElement" class="btn btn-danger confirm">Delete</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM