layer.open({
title:‘添加管理员‘,
type: 1,
content: $(‘.add_html‘).html(),
btn:[‘添加‘, ‘取消‘],
btnAlign:‘c‘,
yes:function (index, layero) {
console.log($(‘input[name=user_name]‘).val());
}
});
一句话, 把 content参数的 html() 去掉就好, 即 content: $(‘.add_html‘) !
layui layer.open弹出框获取不了 input框的值
原文:https://www.cnblogs.com/pyspang/p/11564107.html