I need to append to a DOM object - but I don't know in advance which object that will be (depends what the user selects in the UI). So I must generate the id dynamically and then append - but I'm struggling to find a way to do this.
For example, to append to a table with an id of my-table-13 I'd like to do something like this:
var $Table = 'my-table-' + value;
$(Table)
.append($("<tr>")
.attr('id','my-row'));
I've tried variations of inserting brackets and #'s on the first line - but no success. Is this possible?
$Tablethen the jQuery would start with$($Table), not$(Table).