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