我在同一页面上有两个模态。
我遇到的问题是我无法在第二个模态中输入任何内容。
我有以下HTML:
<section class="border"> <a href="#">
<button id="stop_button">Stop</button>
</a> </section>
<!-- 1st popup : INFO -->
<div class="modal custom fade" id="trackModal" tabindex="-1"
role="dialog" aria-labelledby="trackModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3>
Hello
</h3>
</div>
<div class="modal-body">
<p>This is a test</p>
</div>
<div class="modal-footer">
<div class="btnmodal" data-dismiss="modal" id="close">Close</div>
</div>
</div>
</div>
</div>
<!-- 2nd popup : EMAIL REQUEST -->
<div class="modal custom2 fade" id="trackModal1" tabindex="-1"
role="dialog" aria-labelledby="trackModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span> <span class="sr-only">Close</span>
</button>
<h4>
Type you email
</h4>
</div>
<div class="modal-body">
<p> Please enter your email below
</p>
<form class="contact-form row-form" name="e-mail">
<div class="form-field col-form x-100">
<input id="email" class="input-text js-input" type="email"
required name="email"> <label class="label" for="email">E-mail</label>
</div>
<div class="form-field col-form x-100 text-center"
id="button_form">
<input class="submit-btn" type="submit" value="Submit"
id="button_form2" onclick=" proceed2();">
</div>
</form>
</div>
<div class="modal-footer email-popup"></div>
</div>
</div>
</div>
CSS:
.modal.custom .modal-content {
position: relative;
background: #ECC1CE;
border-radius: 10px;
box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.1);
border: solid 2px white;
margin-top: 120px;
}
.modal.custom2 .modal-content {
position: relative;
background: #ECC1CE;
border-radius: 10px;
box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.1);
border: solid 2px white;
margin-top: 90px;
}
jQuery:
/* first modal */
setTimeout(function() {
$('#trackModal').modal('show');
}, 800);
/* second modal */
$("#stop_button").on("click", function() {
setTimeout(function() {
$('#trackModal1').modal('show');
$('body').find('#trackModal1').focus();
}, 1000);
});
我假设两个模态之间存在冲突。我认为第一个是“隐藏”第二个,因此我无法输入第二个。因此,我尝试将电子邮件模式的代码放在第一个模态的顶部,但它没有改变任何东西。
你知道这里有什么问题吗?
谢谢。
答案 0 :(得分:0)
我已将您的代码添加到小提琴中,它似乎工作得很好 http://www.bootply.com/DrGHmstG8g
检查其余的javascript,因为问题可能与其他可能限制表单编辑的问题有关。