title: Activating td button using JavaScript
body: <p>I have the following function, which is used to expand and collapse child <code>tr</code> rows from parent rows within a table, and also changes the text style of a <code>tr</code> to normal:</p>
  
  <pre><code>$( document ).ready(function() {
       $('.parent').on('click', function(){
            $(this).next('.child').toggle();
            $(this).css('font-weight', 'normal');
  
            &lt;&lt;&lt; ADD COMMAND TO TOGGLE BUTTON HERE &gt;&gt;&gt;
       });
   });
  </code></pre>
  
  <p>I also have the following hidden button within each <code>tr</code>, which I want to submit when a <code>tr</code> is clicked:</p>
  
  <pre><code>&lt;button type="submit" name="read-button" formmethod="POST" value="{{ message.message_id }}" style="display: none;"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>Which command should I include alongside the JavaScript function, in order to achieve this? I believe it will be one of the following (provided by <a href="https://stackoverflow.com/a/5211351/9950593">this</a> answer), however I've only been using JS for a few days so I'm not sure how to include these in my code:</p>
  
  <pre><code>document.getElementById('read-button').submit();
  changeAction('read-button','loginForm');
  document.forms['read-button'].submit();
  </code></pre>
  
  <p>Sample html:</p>
  
  <pre><code>&lt;form method=['POST']&gt;
  &lt;table&gt;
      &lt;tr class="parent"&gt;
           &lt;td&gt;
               &lt;button type="submit" name="read-button" formmethod="POST" value="{{ message.message_id }}" style="display: none;"&gt;&lt;/button&gt;
               &lt;a&gt;Heres a cell&lt;/a&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;a&gt;
                  Heres one more cell
               &lt;a&gt;
           &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="child"&gt;
           &lt;td&gt;
               &lt;a&gt;
                  Some hidden info
               &lt;/a&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;a&gt;
                  More hidden info
               &lt;/a&gt;
           &lt;/td&gt;
      &lt;/tr&gt;
  &lt;table&gt;
  &lt;/form&gt;
  </code></pre>