I have some JavaScript code that loops through a record set using a for loop. The ID of each record is assigned dynamically using this script. For example:
id="header1", id="header2", id="header3"
The numeral at the end of the id is assigned via script.
I also need to select these IDs via jQuery but I do not understand how to insert a variable into my jQuery selector.
I have tried the following (simplified for clarity):
Question
raskren
I have some JavaScript code that loops through a record set using a for loop. The ID of each record is assigned dynamically using this script. For example:
The numeral at the end of the id is assigned via script.
I also need to select these IDs via jQuery but I do not understand how to insert a variable into my jQuery selector.
I have tried the following (simplified for clarity):
None of these things seem to work as jQuery doesn't select the objects I'm trying to get.
Any ideas on how to dynamically create jQuery objects using a counter variable?
Link to comment
Share on other sites
10 answers to this question
Recommended Posts