title: Combining two input fields into one variable
body: <p>Include two IDs into one variable, for example</p>
  
  <pre><code>var optionValue=document.getElementById('Input1' + " " + 'Input2');
  </code></pre>
  
  <p>That code does not work but is there any similar code that would do this? </p>
  
  <p>JS</p>
  
  <pre><code>function addNewListItem(){
  var htmlSelect=document.getElementById('list');
  var value1 = document.getElementById('Input1').value;
  var value2 = document.getElementById('Input2').value;
  var optionValue = value1 + " " + value2;
  var optionDisplaytext = value1 + " " + value2;
  
  var selectBoxOption = document.createElement("option");
  selectBoxOption.value = optionValue.value;
  selectBoxOption.text = optionDisplaytext.value;
  htmlSelect.add(selectBoxOption, null);
  alert("Option has been added successfully");
  return true;
  
  }
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;table border="0" align="left"&gt;
  &lt;tr&gt;
  &lt;td rowspan="2"&gt;
      &lt;select name="list" id="list" size="10" style="width:150px"&gt;
      &lt;/select&gt;
      &lt;/td&gt;
  &lt;tr&gt;
  &lt;td align="right"&gt;Option Value&lt;/td&gt;
  &lt;td align="left"&gt;&lt;input name="Input1" type="text" id="Input1" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td align="right"&gt;Option Display Text&lt;/td&gt;
  &lt;td align="left"&gt;&lt;input name="Input2" type="text" id="Input2" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td align="right"&gt;&amp;nbsp;&lt;/td&gt;
  &lt;td align="left"&gt;&lt;input name="btnAddItem" type="button" id="btnAddItem" value="Add Option" onclick="javaScript:addNewListItem();" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I've tried the above code but it will not add to a listbox? 
  it just says undefined in the box</p>