title: Triggering .click function with enter
body: <p>I'm trying to make some kind of form. User have to click in order to send data further, but when user press 'enter' it returns error.</p>
  
  <p>Script:</p>
  
  <pre><code>$('a.rec_submit').click(function(){
      form_update_mail(1);
      $('input.rec_submit_actual').click();
      return false;
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;a      class="rec_submit"&gt;SEND&lt;/a&gt;
  &lt;input  class="rec_submit_actual" type="submit" /&gt;
  </code></pre>
  
  <p>I've searched a bit, and found that i can use keyup function in order for 'enter' to work also.</p>
  
  <p>example:</p>
  
  <pre><code>$('a.rec_submit').on('keyup click', function(e){
      if (e.which === 13 || e.type === 'click') {
      form_update_mail(1);
      $('input.rec_submit_actual').on('keyup click', function();
      return false;
  )}
  });
  </code></pre>
  
  <p>Yet this doesnt work. Could someone explain what i'm doing wrong?</p>
  
  <p>/////
  EDIT</p>
  
  <p>None of the answers do work.</p>
  
  <p>Form doesn't want to pass email further with 'enter', with 'click' it works just fine.</p>
  
  <p>Error goes: email addres is not valid</p>
  
  <p>Full script:</p>
  
  <pre><code>/*function form_update_mail()
  {
  var tresc_maila='';
  $('#body_mail').val(tresc_maila);
  };*/
  var mail_string = '';
  
  function form_update_mail(x) {
  mail_string += $('input#component_recommend_to').val() + ',';
  if (x == 1) mail_string = mail_string.substring(0, mail_string.length - 1);
  $('#component_recommend_to_actual').val(mail_string);
  }
  $(document).ready(function() {
  $('a#suggestproduct').click(function() {
      $(this).parent().fadeOut(500);
  });
  $('div.projektor_left_frame a, a.u10_polec').click(function() {
      $('div#component_projector_suggestproduct2').fadeIn(500);
      return false;
  });
  $('#component_recommend input').click(function() {
      if ($(this).attr('value') == 'wpisz e-mail' || $(this).attr('value') == 'wpisz imię') $(this).attr('value', '');
  });
  $('a.recommend_add_next').click(function() {
      form_update_mail(0);
      $('input#component_recommend_to').attr('value', '');
      $('input#component_recommend_name_to').attr('value', '');
      return false;
  });
  $('a.rec_submit').keypress(function(e) {
      if (e.which == 13 || e.which == 1) {
          form_update_mail(1);
          $('input.rec_submit_actual').click();
          return false;
      }
  });
  $('#component_recommend_body').val(tresc_maila);
  tresc_maila = 'x';
  $('#component_recommend_body').val(tresc_maila);
  if ($('div.sender_email').length) $('#component_recommend_email').val($('div.sender_email').text());
  if ($('div.sender_name').length) $('#component_recommend_name').val($('div.sender_name').text());
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div id="component_recommend"&gt;
      &lt;form action="contact.php" method="post"&gt;
          &lt;input name="suggest_shop" type="hidden" value="submit"&gt;
          &lt;div class="rec_main"&gt;
              &lt;div class="rec_sub"&gt;
                  &lt;div style="margin-top: 30%; margin-bottom: 2%; font-size: 1.4em;"&gt;
                      Data 1:
                  &lt;/div&gt;
                  &lt;input  id="component_recommend_name"   name="firstname"    type="text" placeholder="Your name" class="rec_form" /&gt;&lt;br /&gt;
                  &lt;input  id="component_recommend_email"  name="email"        type="text" placeholder="Your e-mail" style="margin-top: 5%" class="rec_form" /&gt;
                  &lt;div    style="margin-top: 8%; margin-bottom: 2%; font-size: 1.4em;"&gt;
                      Data 2:
                  &lt;/div&gt;
                  &lt;input      id="component_recommend_name_to"    name="name_to"  type="text" placeholder="His name" class="rec_form" /&gt;&lt;br /&gt;
                  &lt;input      id="component_recommend_to"                         type="text" placeholder="His email" style="margin-top: 5%" class="rec_form" /&gt;
                  &lt;input      id="component_recommend_to_actual"  name="to"       type="text" placeholder="His email" style="display: none;" class="rec_form" /&gt;
                  &lt;textarea   id="component_recommend_body"       name="body"&gt;&lt;/textarea&gt;
                  &lt;a          class="rec_submit"&gt;SEND&lt;/a&gt;
                  &lt;input      class="rec_submit_actual" type="submit" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Case closed
  Thanks to @Mohit Bhardwaj it works</p>
  
  <p>Proper code:</p>
  
  <pre><code>$('a.rec_submit').click(function(){
  form_update_mail(1);
  $('input.rec_submit_actual').trigger( "click" );
  return false;
  });
  
  $('a.rec_submit').on('keyup', function(e){
  var code = e.keyCode ? e.keyCode : e.which;
  if (code == 13) {
  form_update_mail(1);
   $('input.rec_submit_actual').trigger( "click" );
    return false;
  }
  });
  </code></pre>