課程
/前端開發(fā)
/Bootstrap
/玩轉Bootstrap(JS插件篇)
如何確定一個按鈕關閉哪一個警告框呢??用JS來觸發(fā)的話,給按鈕綁定了事件,卻沒有綁定哪一個警告框。。。。
2016-02-14
源自:玩轉Bootstrap(JS插件篇) 4-4
正在回答
<div?class="alert?alert-warning"?role="alert"?id="myAlert"> ????<h4>謹防被騙</h4> ????<p>請確認您轉賬的信息是你的親朋好友,不要輕意相信不認識的人...</p> ????<button?type="button"??class="btnbtn-danger"?id="close">關閉</button> </div> <div?class="alert?alert-warning"?role="alert"?id="myAlert1"> ????<h4>謹防被騙</h4> ????<p>1請確認您轉賬的信息是你的親朋好友,不要輕意相信不認識的人...</p> ????<button?type="button"??class="btnbtn-danger"?id="close1">關閉</button> </div> ??<script?src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script> ??<script?src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> ??<script> ?????$(function(){ ????????????$("#close").on("click",function(){ ????????????????$(this).alert("close"); ????????????}); ????????????$("#close1").on("click",function(){ ????????????????$(this).alert("close"); ????????????}); ??????????}); ??</script>
null__ 提問者
并沒有用。。。
<body>
<div class="alert alert-warning" role="alert" id="myAlert1">
? ? <h4>謹防被騙</h4>
? ? <p>請...</p>
? ? <button type="button" ?class="btn btn-danger" id="close1">關閉</button>
</div>
? ? <div class="alert alert-warning" role="alert" id="myAlert2">
? ? <button type="button" ?class="btn btn-danger" id="close2">關閉</button>
</div> ?
? <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
? <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
? <script>
? ? $(function(){
? ? ? ? $("#close1").on("click",function(){
? ? ? ? ? ? $(this).alert("close"); ?
? ? ? ? }); ? ? ??
? ? ? ? $("#close2").on("click",function(){
? ? ? ? });?
});
? </script>
點擊兩個按鈕都是關閉第二個警告框。。。
陳微語
西風瀟瀟
null__ 提問者 回復 西風瀟瀟
在警告框中加入關閉按鈕
舉報
帶領大家學習怎么使用JS自由控制Bootstrap中提供的組件
1 回答使用button按鈕作為關閉按鈕
1 回答bootstrap 警告框 怎么用js動態(tài)彈出
2 回答為什么關閉彈出框的時候會觸發(fā)shown.bs.modal?
2 回答點擊保存按鈕后不能關閉彈出框
1 回答怎么使用定時器觸發(fā)模態(tài)框
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關注慕課網(wǎng)微信公眾號
2016-05-30
2016-02-14
并沒有用。。。
<body>
<div class="alert alert-warning" role="alert" id="myAlert1">
? ? <h4>謹防被騙</h4>
? ? <p>請...</p>
? ? <button type="button" ?class="btn btn-danger" id="close1">關閉</button>
</div>
? ? <div class="alert alert-warning" role="alert" id="myAlert2">
? ? <h4>謹防被騙</h4>
? ? <p>請...</p>
? ? <button type="button" ?class="btn btn-danger" id="close2">關閉</button>
</div> ?
? <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
? <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
? <script>
? ? $(function(){
? ? ? ? $("#close1").on("click",function(){
? ? ? ? ? ? $(this).alert("close"); ?
? ? ? ? }); ? ? ??
? ? ? ? $("#close2").on("click",function(){
? ? ? ? ? ? $(this).alert("close"); ?
? ? ? ? });?
});
? </script>
點擊兩個按鈕都是關閉第二個警告框。。。
2016-02-14
在警告框中加入關閉按鈕