简体   繁体   English

如何使用纯 javascript 将 HTML 文本输入附加到表格

[英]How to append HTML text input to table using pure javascript

I have two text input one for name and the other for date of birth.I have one Add button such that when i click the add button the name and date of birth should arrange in order in my table.The table heading are ORDER,USERNAME,BIRTHDAY and lastly the CONTROL which should be able to delete and and edit name.我有两个文本输入,一个是姓名,另一个是出生日期。我有一个添加按钮,这样当我点击添加按钮时,姓名和出生日期应该在我的表格中按顺序排列。表格标题是 ORDER,USERNAME ,BIRTHDAY 最后是 CONTROL,它应该能够删除和编辑名称。 USING JAVASCRIPT.使用 JAVASCRIPT。

It sounds like Jquery append() may be your best option.听起来像 Jquery append() 可能是你最好的选择。

It works in the following manner.它以下列方式工作。

$( ".class" ).append("html / text to be appeneded");
$( "#id" ).append("html / text to be appeneded");
$( ".class" ).append(data);
$( "#id" ).append(data);

This is similar to Jquery html() but append simply adds on to a point where as html() overwrites what is there.这与 Jquery html() 类似,但 append 只是添加到一个点,因为 html() 覆盖了那里的内容。

There is also attr() which allows you to add and modify attributes of a given html entity.还有 attr() 允许您添加和修改给定 html 实体的属性。

Here is a link to the documentation for append() http://api.jquery.com/append/这是 append() http://api.jquery.com/append/文档的链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 JavaScript 中的 forEach 方法将值 append 输入到 html 表? - How to append input values to a html table using forEach method in JavaScript? 如何使用纯 JavaScript 和 append 创建一个文本文件? - How do I create a text file using pure JavaScript, then append to it? 如何使用纯/本地JavaScript和html将文本框中的输入数据保存到excel? - How to save input data from text box to excel using pure/native JavaScript and html? 如何使用javascript将行附加到html表? - How to append row to html table using javascript? 如何使用JavaScript获取没有HTML元素的纯文本? - How to get the pure text without HTML element using JavaScript? 如何将append HTML内容与CSS、JS在当前网页中使用纯javascript? - How to append HTML content with CSS, JS in current webpage using pure javascript? 用纯JavaScript追加后如何获取html元素? - How to get html element after append with pure JavaScript? 如何使用纯Java脚本观看输入文本框 - How to watch an input textbox using pure Javascript 如何使用 JavaScript 显示 html 输入:.html(&#39; &lt; input type=&quot;text&quot; /&gt;&#39;) - How to display a html input using JavaScript : .html(' < input type="text" />') 如何使用Javascript将JSON响应输出附加到html表中 - How to append JSON response output into html table using Javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM