title: Click image to initiate a search in Rails
body: <p>I have placed an image of a magnifying glass within a text box so that the user can click this to initiate their search. At the moment if you press 'Enter' the search function is carried out, but need a click event also.</p>
  <p>This is my HTML and CSS as it is:</p>
  <pre><code>&lt;form accept-charset=&quot;UTF-8&quot; action=&quot;/blog&quot; class=&quot;searchPosts&quot; method=&quot;get&quot;&gt;
    &lt;input id=&quot;search&quot; name=&quot;search&quot; placeholder=&quot;Search Here&quot; type=&quot;text&quot; /&gt;      
  &lt;/form&gt;
  
  
  .searchPosts {
    background:url(&quot;/assets/bg_dots_grey.png&quot;) repeat;
  }
  
  #search {
   background:url('/assets/search.png') no-repeat right;
   padding-right:0px;
  }   
  </code></pre>
  <p>The Ruby to produce the form:</p>
  <pre><code>&lt;%= form_tag blog_path, :method =&gt; 'get', :class =&gt; 'searchPosts'  do %&gt;
    &lt;%= text_field_tag :search, params[:search], :placeholder =&gt; 'Search Here' %&gt;
  &lt;% end %&gt;   
  </code></pre>
  <p>Notice there is no submit_tag as I did not want the user to click a button to carry out the request.</p>
  <p>Do I need to add the submit_tag back in and style that with CSS to fit within the input field? Or is this a case for a jQuery solution? If not how would I go about this?</p>