[英]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.