zoukankan      html  css  js  c++  java
  • layui获取弹出层内容

    一、

    弹出层:

    <body class="childrenBody">
    <form class="layui-form">
    <div class="replay_edit">
    <textarea class="layui-textarea msgTxt" id="msgTxt"></textarea>
    </div>
    </form>
    <script type="text/javascript" src="~/Resources/plugins/layui/layui.js"></script>
    <script type="text/javascript">
    var callbackdata = function () {
    return this.document.getElementById("msgTxt").value;
    }
    </script>
    </body>

    主页面:

    var index = layui.layer.open({
    title: "tile",
    type: 2,
    area: ['390px', '220px'],
    content: "dialog",
    btn: ['提交'],
    yes: function (index) {
    //当点击‘确定’按钮的时候,获取弹出层返回的值
    var res = window["layui-layer-iframe" + index].callbackdata();
    //打印返回的值,看是否有我们想返回的值。
    console.log(res);
    //最后关闭弹出层
    layer.close(index);
    },

    二、

    layer.prompt({
    formType: 2
    , title: 'title'
    , value: ""
    }, function (value, index) {
    alert("q"+value);
    });

  • 相关阅读:
    html5 悬浮提示框
    ajax 接收json
    ajax 发送参数
    jquery无刷新请求ajax
    jQuery 发送 ajax json 请求
    html5 三级联动菜单
    iframe 用法
    html5 复制文字
    bootstrap表单按回车会自动刷新页面的问题
    jquery版本不兼容问题
  • 原文地址:https://www.cnblogs.com/yj2010/p/8551537.html
Copyright © 2011-2022 走看看