Javascript 当它';s通过jquery添加动态 $(“#添加”)。单击(函数() { $(“#内容”)。追加(“”); })

Javascript 当它';s通过jquery添加动态 $(“#添加”)。单击(函数() { $(“#内容”)。追加(“”); }),javascript,jquery,Javascript,Jquery,我必须使用动态添加文本框,以便如何在php中获取这些值 hay它只是像数组一样的资源名称 资源[]Jquery动态添加: $("#add").click(function() { $("#content").append("<input type=text name=resource>"); }) $("#add").on('click',function() { $("#content").append("<input type=text name=resource

我必须使用动态添加文本框,以便如何在php中获取这些值

hay它只是像数组一样的资源名称
资源[]

Jquery动态添加:

$("#add").click(function()
{
  $("#content").append("<input type=text name=resource>");
})
$("#add").on('click',function()
{
  $("#content").append("<input type=text name=resource[] />");
});
$data =$_POST['resource'];
对于单个值:

$("#add").click(function()
{
  $("#content").append("<input type=text name=resource>");
})
$("#add").on('click',function()
{
  $("#content").append("<input type=text name=resource[] />");
});
$data =$_POST['resource'];

如果php变量可用,那么您可以将该变量添加到append或以下任意位置

foreach($data as $vals)
{
   echo $vals;
}
$(“#添加”)。单击(函数(){
$(“#内容”).append(“输入类型=文本名称=资源值=”“>);
});

其余的代码(您尝试过的)?这不是一个PHP问题!您想要什么我无法理解……。很难理解您(代码)为什么要使用
.live()
?绝对没有理由这样做,而且
live
也被弃用!