使用引导程序,我们从按钮 1 到按钮 6 大约有多个 div。使用 jquery,将出现一个带有另外 2 个按钮的模式,取消并确认。
现在,当我单击确认时,模式将关闭并且按钮的状态将改变。例如,Button1 更改为“Clicked”。当我单击取消时,模态将关闭。
问题是这样的:当我单击第一个按钮并取消,然后单击第二个按钮并确认时,两个按钮都会变为“已单击”
4 个按钮或 5 个按钮也是如此。
我的html
<!-- START OF PAID CUSTOM MODAL -->
<div id="paid-custom-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Fees Payment For</h3>
</div>
<div class="modal-body">
CONFIRM?
</div>
<div class="modal-footer">
<button class="paid-custom-cancel btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="paid-custom-confirm btn btn-primary">Confirm</button>
</div>
</div>
<!-- END OF PAID CUSTOM MODAL -->
<div class="paid-custom">BUTTON 1</div>
<div class="paid-custom">BUTTON 2</div>
<div class="paid-custom">BUTTON 3</div>
<div class="paid-custom">BUTTON 4</div>
<div class="paid-custom">BUTTON 5</div>
<div class="paid-custom">BUTTON 6</div>
我的jQuery
$(document).ready(function(){
$(document).on('click', ".paid-custom", function() {
var $this=$(this);
$('#paid-custom-modal').modal();
$(document).on('click', ".paid-custom-confirm", function() {
$this.html('CLICKED');
$('#paid-custom-modal').modal('hide');
});
});
});