title: How can I check ID of a clicked element js
body: <p>How can I check if an ID of a clicked element is lets say 'target'.</p>
  
  <p>What I am trying to do is actually show and hide comment form on clicking in the text field and hide it when the user clicks out of the form. The problem is that if the user clicks Submit button the form hides and nothing is sent over. So I'll have to check if the submit buttons id matches the clicked element and not hide it in this case.</p>
  
  <p>I am using ruby on rails <code>remote_form_for</code> and <code>onblur</code> and <code>onfocus</code> events now.</p>
  
  <p>This is my bigger form that I am showing.</p>
  
  <pre><code>&lt;div id="bigArea" style="display:none"&gt;
  &lt;% remote_form_for @horses do |f|%&gt;
  &lt;%= f.text_area :description, {:onBlur=&gt;"{$(bigArea').hide();$('smallField').show();}"} %&gt;
  &lt;%= f.submit "Submit"%&gt;
  &lt;% end %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and this is the smaller form field that hides every time you click in it.</p>
  
  <pre><code>&lt;div id="smallField"&gt;
  &lt;%= text_field_tag 'sth',"Click to comment, {:onFocus=&gt;"$('bigArea').show();$('smallField').hide();"} %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My question is how can I disallow the form to hide when a user clicks submit button? I suppose I should check which element's id has been clicked, and if it's submit button's ID I should not hide the form. Or maybe there is some other way to do all this?</p>
  
  <p>I would greatly appreciate any answers!</p>