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 7595643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:43:19+00:00 2026-05-30T21:43:19+00:00

I have something like this: $(‘#find’).click(function() {… I need to also add to that

  • 0

I have something like this:

$('#find').click(function() {...  

I need to also add to that event that if they press the enter key it will also execute.

I was thinking something along the lines of:

var code = (e.keyCode ? e.keyCode : e.which);  
if ( ($('#find').click()) || (code == 13)) {

But obviously it does not work. How can I merge both ways into one. Pressing enter should work only when done in the input with id=”code”. The click event is for another input type button with id=”find”. I want to merge both that, if the user presses enter while typing the code or clicking the button to send the code, both ways work the same way.

  • 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-30T21:43:20+00:00Added an answer on May 30, 2026 at 9:43 pm

    you can do it like this:

    function myHandler(){
      $(this).css('background-color', 'green'); //whatever you need to do here
    }
    $('#find').click(myHandler); 
    $('#find').keypress(function(){
       var code = (e.keyCode ? e.keyCode : e.which);  
       if(code == 13) myHandler();
    ); 
    

    or maybe use keyup, you should read the docs on that: http://api.jquery.com/keyup/

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

Sidebar

Related Questions

i have something like this: $(#btn).click(function (event) { $.getJSON(url, function (data) { // i
I have something like this... $().ready(function () { $(.post .comment_this).click(function () { var comment_id
I have something like this: <a href=# id=lol>LOL</a> <script type=text/javascript> $('#lol').click(function(){ $.get(<?php echo $host.'/index.php'?>,
I have something like this in mind: <appSettings> <add key=ConfigName value=configuration culture=1033 /> <add
I have something like this: something need here = scope.getConnections(); //getConnections() returns Collection<Set<IConnection>> I
I have something like this: <tr id='<%=currentRow %>' onclick=SetBackgroundColor(this) style=background-color:Yellow> When i click on
I have something like this: var Something = function(){ this.render = function(){}; $(window).resize(function(){ this.render();
i have something like this <body> <h2> Blue <span> <a ....>add to combo</a> </span>
I have something like this: $.getJSON('/scripts/commons/theScriptDoTravelBackInTime.php',{ }, function(){ // etc.. etc... } }); Is
I have something like this create function Answers_Index(@id int, @questionID int) returns int as

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.