javascript - Add alert to bootstrap popup layer
天蓬老师
天蓬老师 2017-05-19 10:23:55
0
2
439

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.

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
PHPzhong

1 handful$("#submit").on('click',function(){}) 改成$("#submit").unbind('click').bind('click',function(){})Try

2. 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...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!