Hudhaifa Yoosuf Hudhaifa Yoosuf - 1 year ago 87
jQuery Question

Appending variable into a string with quotes

I have a problem appending a variable to a string which is already concatenated.

var count = $("#salesdetaildata").children.length;
var data ="<td name='Data[appendhere]'></td>";

I need to append the count variable into the place where "appendhere" is.

Answer Source

You can add data into the string by using + signs. At least that's what I'm assuming you're after:

var count = $("#salesdetaildata").children.length;
var data ="<td name='Data["+count+"]'></td>";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download