Reputation: 431
How to append a textbox to a table row with jQuery?
Upvotes: 0
Views: 9554
Reputation: 397
How can you append an input type to a table row? You have to append it to a table cell, if not you can position it absolute at the position of the table row. You can't append it to a row via the DOM,
Seeing your other question, why don't you add an input type hidden to the first cell of the row? You could easily do this like this:
$('tr#id td:first').append($('<input type="hidden" id="hidden_field" name="hidden_field" value="your value" />'));
Upvotes: 2
Reputation: 18984
Give the destination element and ID. Then:
$('#destinationId').append('<input type="text" name="newBox" />');
Upvotes: 0
Reputation: 1109725
Use the append()
function.
var tr = getItSomehow();
var textbox = $('<input type="text" id="foo" name="foo">');
tr.append(textbox);
Upvotes: 2