views:

176

answers:

1

Why this code:

row.append($("<td></td>").text("someText"));

...isn't working, and how can I fix it?

Thanks.

+3  A: 

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>")
Russ Cam