在使用jQuery替换div替换文本框时遇到问题 [英] getting problem to replace textbox with div with jquery

查看:55
本文介绍了在使用jQuery替换div替换文本框时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题: div仅出现一秒钟,然后消失..... ????????

$(document).ready(function () {

    $("#done").click(function () {
        $('#txtname').replaceWith(function () {

            return '<div>' + $(this).val() + '</div>';
        });
    });

推荐答案

(文档).ready(
(document).ready(function () {


( #完成" ).click(函数(){
("#done").click(function () {


( ' #txtname').replaceWith( function (){ 返回 ' < div>' +
('#txtname').replaceWith(function () { return '<div>' +


这篇关于在使用jQuery替换div替换文本框时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆