title: Form Submit with Div onClick
body: <p>I'm trying to use a div to submit a form. Here's the HTML:</p>
  
  <pre><code>&lt;form name="search-form" 
        id="search-form" 
        action="php.php" 
        class="form-search"&gt;
  
      &lt;input style="color: black; background: rgba(255,255,255,0.5); padding: 15px; font-size: 18px;" 
             type="text" 
             name="search" 
             class="input-medium search-query"&gt;
  
          &lt;div class="button1" onClick="document.forms["search-form"].submit();"&gt;
              &lt;a href="#"&gt;
                  &lt;img  alt="" src="/img/buttons/icon1.png" /&gt;
              &lt;/a&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>The form does not submit when the div is clicked. Could someone point out the problem?
  thanks. I've been trying this for an hour at least.</p>
  
  <p>The <code>a href</code> is needed to keep the styling, but even if I remove it and left with just the icon, the submit doesn't work; nor does it work if I apply the <code>onclick</code> to the image.</p>