Adding text to a table data cell with jQuery
Why this code:
row.append($("<td></td&g开发者_高级运维t;").text("someText"));
...isn't working, and how can I fix it?
The code works fine, as demonstrated with this Working Demo. Add /edit to the URL to see the code. Tested in Firefox 3.5 and IE 6
$('button').one('click', function() {
$('#myTable tr:last').append($("<td></td>").text("someText"));
});
Also, you might consider shortening the creation of the cell element to
$("<td>someText</td>")
精彩评论