Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4540880
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:08:51+00:00 2026-05-21T15:08:51+00:00

I want to click enter instead of submit button and I want jquery to

  • 0

I want to click enter instead of submit button and I want jquery to do the exact same task as if I were clicking the submit button.

This is what I have but its not working

the jquery

$("#search-friend-text").keypress(function(e){ // start enter click

    switch(e){

        case 13: 
        $.post("<?php echo site_url('userProfile/search_friend'); ?>", 
        $("#add-friend-search").serialize(),
        function(data){
           $("#insert-activity").html(data);
        });

    $("#add-friend-search").slideUp("slow",function(){});
    break;

    }

}); // end enter click

the Html (form)

<form method="post" action="" name="searchFriendForm" id="add-friend-search">
<input type="text" id="search-friend-text" name="searchFriendText">
<input type="button" class="small green button" id="add-friend-button" />


</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T15:08:52+00:00Added an answer on May 21, 2026 at 3:08 pm

    I think this will solve it

    switch(e.keyCode) 
    

    Since e is the event handler

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form called MainForm.cs. When I click Enter The Progam button I
I have a button: <button>Click</button> I want click it and open a new window
I want to click the video on this page http://37.128.191.200/?640 using JavaScript but can't
I have this. I want to click and transfer the clicked data to another
I have an application page. I want to click a button to pop out
I have two button name A, and B want to click them equal to
I want to click a button on my access form that opens a folder
I have a little question I want to click on my smileys and insert
I have some textboxes on a page and I want to click a link
I have a linkbutton in gridview and i want to click event on code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.