bootstrap Add alert on the pop-up layer and cancel it after opening the modal. After opening the modal a second time and triggering the alert event, it will alert twice!
$("#" + data[i].id).on('click', function () {
var that = this;
$("#uploadmodal").modal('show');
$("#submit").on('click', function () {
var val = $('#sykmmc option:selected').text();
var opV = $('#sykmmc option:selected').val()
if(opV=="10086"){
alert('您还未选择科目!');
return false;
}
$(that).parent().find("span").text(val)
if($(that).text()=="匹配"){
$(that).text("修改")
}
if($(that).parent().parent().find("td").eq(4).text()=="未匹配") {
$(that).parent().parent().find("td").eq(4).text("已匹配")
}
$("#uploadmodal").modal('hide');
})
}
Every time the modal is canceled and the modal is triggered again after it is opened again, there will be one more alert than before.
1 handful
$("#submit").on('click',function(){})
改成$("#submit").unbind('click').bind('click',function(){})
Try2. You can also put $("#submit") after
$("#" + data[i].id).on('click',function(){});
. The reason is that you have registered multiple times.Didn’t I say that it is not recommended to pop up multi-layered pop-up windows? Our product manager said that this is not a good user experience...