4
$('#tbreceipts tr:last').after('<tr><td>data3[i].amount</td></tr>');

I have tried to add values to table cells using this code within a for loop while adding rows to table.

This code doesn't seem to be working, why is this?

1 Answer 1

3

This is because you're trying to load in a variable to a string.

Close the string, use the add operator +, add the variable and then add the rest of the string on.

$('#tbreceipts tr:last').after('<tr><td>'+data3[i].amount+'</td></tr>');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.