简体   繁体   English

数据附加到表的第一行

[英]Data append to the top row of the table

how can I append the data to the top row of my table. 如何将数据附加到表的第一行。 Here is my code: 这是我的代码:

   $(data).appendTo('#feeds:last');

How can I append data to the top row of my table? 如何将数据附加到表的第一行?

If you want to add an element to the top of a table you can use prepend() : 如果要将元素添加到表的顶部,可以使用prepend()

$('#feeds').prepend(data);

Example here: http://jsfiddle.net/KZ7qc/ 此处的示例: http : //jsfiddle.net/KZ7qc/

jQuery docs: http://api.jquery.com/prepend/ jQuery文档: http//api.jquery.com/prepend/

If I have misunderstood your question and you really want it to be the last row, then you can just change the above code to append() 如果我误解了您的问题,而您确实希望它是最后一行,则可以将上面的代码更改为append()

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM