title: Cannot get value of a first TD in current row
body: <p>My requirement is to have 3 check-boxes in each table row, and once the checkbox is checked, it will create a hidden input with the value corresponding to the first <code>&lt;td&gt;</code> of THAT particular row.</p>
  
  <p>Here is a sample row:</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td&gt;user1&lt;/td&gt;
      &lt;td&gt;768.51&lt;/td&gt;
      &lt;td&gt;4,680&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0%&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;&lt;input type="checkbox" name="&gt;1 year and &lt;=2 years[]" onclick="createUserNameInput()"&gt;&lt;/td&gt;
      &lt;td&gt;0.00&lt;/td&gt;
      &lt;td&gt;0.00%&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;&lt;input type="checkbox" name="&gt;2 years and &lt;=3 years[]" onclick="createUserNameInput()"&gt;&lt;/td&gt;
      &lt;td&gt;768.51&lt;/td&gt;
      &lt;td&gt;100.00%&lt;/td&gt;
      &lt;td&gt;4,677&lt;/td&gt;
      &lt;td&gt;&lt;input type="checkbox" name="&gt; 3 years[]" onclick="createUserNameInput()"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Once any of the 3 check-boxes are checked, this hidden input should be created. If 3 are checked, 3 inputs should be created. <code>&lt;value&gt;</code> of these inputs should equal the value of first <code>&lt;td&gt;</code> in <strong>THIS</strong> row, which is <code>user1</code>. Here is how I am trying to implement it (code is inconsistent but I just need to get it working first):</p>
  
  <pre><code>&lt;script&gt;
      function createUserNameInput() {
          // var input = document.createElement("input");
          // input.setAttribute("type", "hidden");
          // input.setAttribute("name", "user");
          // input.setAttribute("value", $(this).parent().siblings(":first").text()); // VALUE IS EMPTY
          // document.getElementById("main-form").appendChild(input);
  
          alert($(this).parent().siblings(":first").text()); // VALUE IS EMPTY
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>I have referenced these previous posts but none of those solutions work for me. When I run <code>alert()</code>, value is empty - nothing is displayed:</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/19952781/get-first-td-of-this-row?noredirect=1&amp;lq=1">Get first TD of THIS row</a></li>
  <li><a href="https://stackoverflow.com/questions/2931234/jquery-get-the-value-of-first-td-in-table?noredirect=1&amp;lq=1">Jquery- Get the value of first td in table</a></li>
  </ol>
  
  <p>Who can help? If it can be done without jQuery, even more amazing!</p>