innerHTML on a td element
innerHTML on a td element
Could someone possibly suggest why this code works...
var contraRow = aRow.cloneNode(true);
$('td:gt(13)', contraRow).remove() ;
...but this code does not...
var contraRow = aRow.cloneNode(true);
$('td:gt(13)', contraRow).innerHTML = " " ;
...I want to make those td elements blank, not delete them completely.
var contraRow = aRow.cloneNode(true);
$('td:gt(13)', contraRow).remove() ;
...but this code does not...
var contraRow = aRow.cloneNode(true);
$('td:gt(13)', contraRow).innerHTML = " " ;
...I want to make those td elements blank, not delete them completely.
This discussion has been closed.
Replies
If you want to make the TD element empty, then I would suggest that $().remove() is not the right thing to use, since it will delete the elements (according to the jQuery documentation). I think the situation might be getting confused by the cloneNode - remember that is operating on the cloned node, and to see the effect you would need to add that back into the DOM. Certainly putting a blank string into innerHTML will clear a node out.
Possibly a question for the jQuery mailing list rather than DataTables, if this doesn't answer it :-)
Regards,
Allan