zoukankan      html  css  js  c++  java
  • layer弹层content写错导致div复制了一次,导致id失效 $().val() 获取不到dispaly:none div里表单的值

    错误之源:

    $("a.consult").click(function () {
            lib_consult_html = $('#consult-html').html();  /*复制了一份div*/
            layer.open({
                type: 1,
                title: false,
                closeBtn: 0,
                shadeClose: true,
                content: lib_consult_html  /*这里写迷了吧*/
           });
        });

    查看layer文档修改后:

    $("a.consult").click(function () {
             layer.open({
                type: 1,
                title: false,
                closeBtn: 0,
                shadeClose: true,
                content: $('#consult-html')
            });
        }); 

     然后div里的提交事件就生效了:

     $('#model_click').click(function () {
            var phone = $('#z_phone').val();
            var budget = $('#z_budget').val();
            var data = $("#model_form").serializeArray();
            console.log(data);
            if (phone != "" && budget != "") {
                $.ajax({
                    url: '/tools/submit_ajax.ashx?action=my_modelSend',
                    dataType: "text",
                    type: 'post',
                    data: data,
                    success: function (date) {
                        alert(date);
                        console.log(date);
                        document.getElementById("model_form").reset();
                    }
                });
            } else {
                alert("联系电话和预算必填哦!!!");
            }
        });

  • 相关阅读:
    MyEclipse使用总结——MyEclipse10安装SVN插件
    SVN的安装和配置
    Git
    myeclipse 怎么安装与激活
    jQuery
    sql server 2008
    原问题:身份证为什么只有15位
    QTP10破解方法及mgn-mqt82.exe下载
    WARNING [Project: :app] To shrink resources you must also enable ProGuard
    your local changes would be overwritten by merge. commit stash or revert them to proceed. view them
  • 原文地址:https://www.cnblogs.com/baocaige/p/10023693.html
Copyright © 2011-2022 走看看