I have a script that writes a value from a form to a <td>, like so:
var num_rows = 1;
$(".add_menu_item").click(function() {
var value1 = $('#dealer_type').val();
if (value1.length) {
if (num_rows == 1) {
$('.dealer_contact_list').find('tr:last').after('<tr>').append(
$("<td id='type'></td>").text(value1),
} else {
$('#type').attr('rowspan', num_rows + 1);
}
}
num_rows++;
});
Now I want to write the value in an input field but still wrap it in a <td>. I have tried to do it like so, but can’t get it to work. Any ideas?
$("<input>").val(value1).wrap("<td id='type'></td>"),
You could possibly try:
That should give you a
tdwith an textinputinside it.