Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery追加表单输入?_Jquery_Html_Forms_Input - Fatal编程技术网

jquery追加表单输入?

jquery追加表单输入?,jquery,html,forms,input,Jquery,Html,Forms,Input,我有一个jquery脚本,用来附加输入框,它不会发生,我不知道为什么 jquery: $(document).ready(function() { $(".login").click(function(){ $(".login").hide(); $("div.swap").append("<input name="username" id="username" type="text" maxlength="16" />"); });

我有一个jquery脚本,用来附加输入框,它不会发生,我不知道为什么

jquery:

$(document).ready(function() {
    $(".login").click(function(){
        $(".login").hide();
      $("div.swap").append("<input name="username" id="username" type="text" maxlength="16" />");

     });

});
$(文档).ready(函数(){
$(“.login”)。单击(函数(){
$(“.login”).hide();
美元(“分割掉期”)。追加(“”);
});
});
html:


您的追加使用双引号将字符串和字符串中的边括起来。试试这个:

$(document).ready(function() {
    $(".login").click(function(){
       $(this).hide();
       $('<input name="username" id="username" type="text" maxlength="16" />').appendTo("div.swap");
    });
});
$(文档).ready(函数(){
$(“.login”)。单击(函数(){
$(this.hide();
美元(“”)。附于(“部门掉期”);
});
});

您的追加使用双引号将字符串和字符串中的边括起来。试试这个:

$(document).ready(function() {
    $(".login").click(function(){
       $(this).hide();
       $('<input name="username" id="username" type="text" maxlength="16" />').appendTo("div.swap");
    });
});
$(文档).ready(函数(){
$(“.login”)。单击(函数(){
$(this.hide();
美元(“”)。附于(“部门掉期”);
});
});
waaay off-topic,但我浏览了一下您的用户页面,然后浏览了您的网站。我想我应该提到(假设这不是一个玩笑)你的网站在它的upper-edge.waaay off-topic上显示了一个php警告,但是我浏览了一下你的用户页面,然后浏览了你的网站。我想我应该提到(假设这不是一个玩笑)您的站点在其上边缘显示了一个php警告。