I have a basic problem with selecting elements using jQuery. I have dynamically added table rows in a table, each with a dynamically generated ID.
I basically have this code that I was using when the table rows did not have an ID. Now, I have added other features which necessitated assigning table rows with IDs.
This was the code I was using before to toggle certain columns in each row:
$("#row .col[data-col='" + col + "']").toggle();
This is how I am assigning IDs to my rows:
<tr id="row_'+(currentIndex-1)+'">
How can I now use jQuery to select the above row with it's dynamic ID and use it with my code to toggle my columns?
I have tried this but id doesn't work:
$("#row_'+(currentIndex-1)+' .col[data-col='" + col + "']").toggle();
$("#row_" + (currentIndex-1) + " .col[data-col='" + col + "']").toggle();try thisUncaught Error: Syntax error, unrecognized expression: #row_'+(currentIndex-1)+' .col[data-col='column1']$("#row_" + (currentIndex-1) + " .col[data-col='" + col + "']").toggle();