title: What is the vanilla JavaScript equivalent to $(this).parent().submit()?
body: <p>I have a form I am trying to submit with HTML and JavaScript. I have attached an event listener to my checkboxes (<code>.checkbox</code>), that waits for a click, and upon a click, launches a function that attempts to submit the form. </p>
  
  <p>I have succeeded with jQuery's <code>.parent()</code> usage, but am now attempting to switch that to vanilla JS.</p>
  
  <p>I have tried <code>this.parentNode.submit();</code>, however it gives back the error message. </p>
  
  <pre><code>this.parentNode.submit is not a function at HTMLInputElement.formSubmit
  </code></pre>
  
  <p>Is there a possible way I can submit my form by replacing the jQuery <code>$(this).parent().submit()</code> to a vanilla JS equivalent?</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form id="theform" action="/phones/search_results" accept-charset="UTF-8" data-remote="true" method="post"&gt;&lt;input name="utf8" type="hidden" value="✓"&gt;
    &lt;label&gt;
      &lt;input type="checkbox" name="brand_name" id="brand_name" value="Apple" class="Apple brand checkbox" style="height: 30px;"&gt;
          Apple
  
    &lt;/label&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>$(function() {
    var checkbox = document.querySelectorAll(".checkbox");
    for (var i = 0; i &lt; checkbox.length; i++) {
      checkbox[i].addEventListener("click", formSubmit)
    }
  
  });
  function formSubmit(){
    if(this.checked){
      $(this).parent().submit();
      console.log("Form was submitted" + this.parentNode)
    }
  }
  </code></pre>