bootstrap可关闭警告框
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Bootstrap 实例 - 警告框(Alert)插件事件</title> 6 <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css"> 7 <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script> 8 <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script> 9 </head> 10 <body> 11 12 <div id="myAlert" class="alert alert-success"> 13 <a href="#" class="close" data-dismiss="alert">×</a> 14 <strong>成功!</strong>结果是成功的。 15 </div> 16 <script type="text/javascript"> 17 $(function(){ 18 $("#myAlert").bind(‘closed.bs.alert‘, function () { 19 alert("警告消息框被关闭。"); 20 }); 21 }); 22 </script> 23 24 </body> 25 </html>
警告框都关闭:
1 <script type="text/javascript"> 2 $(function(){ 3 $(".close").click(function(){ 4 $(".alert").alert(‘close‘); 5 }); 6 }); 7 </script>
时间: 2024-11-06 15:43:32