首页 新闻 赞助 找找看

jquery 获取值问题

0
悬赏园豆:20 [已解决问题] 解决于 2017-05-19 16:59
复制代码
function pageRender(type, title, msg) { /** 渲染页面**/
var html = "";
html += '<div id="msg_box"></div><div id="msg_con"><span id="msg_tit">' + title + '</span>';
html += '<a id="msg_ico">x</a><div id="msg_msg"><input id=\"Text112\" type=\"text\" value=\"222\" />' + msg + '</div><div id="msg_btnbox">';
if (type == "alert") {
html += '<input id="msg_btn_ok" type="button" value="确定" />';
}
if (type == "confirm") {
html += '<input id="msg_btn_ok" type="button" value="确定" />';
html += '<input id="msg_btn_no" type="button" value="取消" />';
}
html += '</div></div>';
//必须先将html添加到body,再设置Css样式
$("body").append(html);
renderCss(); //渲染样式
};


            //确定按钮事件
        function btnOk(callback) {
                $("#msg_btn_ok").click(function() {
                    var text = $("#Text112").val();
                    alert(text);

                });
        }
复制代码

这样获取不到Text112的值,提示undefine,各位大神有什么好的方法获取该值

sofootball的主页 sofootball | 初学一级 | 园豆:44
提问于:2017-05-19 16:34
< >
分享
最佳答案
0

大兄弟 你漏了一个#

收获园豆:20
筱浬 | 小虾三级 |园豆:601 | 2017-05-19 16:54
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册