title: Using variable for an identifier name (using jquery selectors)
body: <p>Believe me, I've been looking for examples online for hours. None of them seem to help. </p>
  
  <p>I'm working on making a table. There are some columns with dropdown menu and I've assigned ID to each menu. Inside a loop, I'm trying to assign selected value for each dropdown menu.</p>
  
  <pre><code>var row$ = $('&lt;tr/&gt;');
  function updateDataBodyGenerator(myList) {
      for (var i = 0 ; i &lt; myList.length ; i++) {
          var row$ = $('&lt;tr/&gt;');
          var colIndex = 0;
  
          for (var key in myList[i]) {
  
              var cellValue = myList[i][columns[colIndex]];
              if (cellValue == null) { cellValue = ""; }
              var severityDropDownMenu = "severityDropDownMenu" + i;
              colIndex++;
              switch (key) {
                  case "Test Case":
                      ...
                      break;
                  case "Test Result":
                      ...
                      break;
                  case "Severity":
                      var severitySting = '&lt;td&gt;&lt;select id="' + severityDropDownMenu + '" class="dropDownMenu"&gt;' +
                          '&lt;option value="Red"&gt;Red&lt;/option&gt;' +
                          '&lt;option value="Green"&gt;Green&lt;/option&gt;'+
                          '&lt;option value="Yellow"&gt;Yellow&lt;/option&gt;';
  
                      row$.append($(severitySting));
  
                      //failed
                      //$("#severityDropDownMenu" + i).val(cellValue);
  
                      //failed
                      //var selectorString = "#" + severityDropDownMenu.toString();
                      //$(selectorString).val("Green");
  
                      //failed
                      //$("#" + severityDropDownMenu).val(cellValue);
  
                      //failed
                      //var selectorString = '#' + severityDropDownMenu;
                      //$(selectorString).val(cellValue);
  
                      //works
                      //$('#severityDropDownMenu0').val(cellValue);
  
                      ...
  </code></pre>
  
  <p>As you can see in the comments, I've tried several approaches and only 1 worked which was $('#severityDropDownMenu0').val(cellValue); but that will only change 1 dropdown menu. </p>
  
  <p>I appreciate your time and assistance. </p>