Hi everyone I want to replace data inside the row depending upon the row number. The code I have posted traverses through the rows in the table, counts the row-indexes and matches them with the required row. If condition gets true the data should be replaced in that row. I have edited the question
I don't know what should I use to replace the data?
I have tried .innerHTML, .replaceWith() but they do not give me the required thing.
$('table#table-mytable tr').each(function(){
var row_required = tag[tag.length-2];
console.log('this is row_required: '+row_required);
var row = $(this).index()+1;
console.log('this is row: '+row);
if(row==row_required) {
(What should I enter here)
}
});
I want replace with something like: replaceWith('td colspan="2" input type="text" name="input_" class="input_" id="input_" value="' + input_tag + '" placeholder="Enter Label" /td>')?
<td>) which contain the content. So you are looking for something likerow.find('td').html('The new text')