表单输入字段不显示,javascript/jquery

Form input field not showing, javascript/jquery

本文关键字:javascript jquery 显示 输入 字段 表单      更新时间:2023-09-26
$(document).ready(function() {
  $.ajax({
    type: "get",
    url: "textman.php",
    success: function(data) {
      $('#textbaz').append(data);
      $('#textbaz').append("<input id='textbox' type='text' placeholder='Type it man, your on the clock!'");
    }
  })
})
以上是我的javascript代码。第一个命令(将数据追加到textbaz)运行良好,并打印了数据。问题是,第二行断掉了。由于某些原因,它只是没有打印出来,我检查了chrome开发工具,它根本不在那里。我很困惑,任何和每一个帮助都是非常感谢的。
$('#textbaz').append("<input id='textbox' type='text' placeholder='Type it man, your on the clock!' />");

你需要关闭输入标签

您错过了关闭输入元素的/>:

<input id='textbox' type='text' placeholder='Type it man, your on the clock!' />
----------------------------------------------------------------------------- ^ here