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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:01:05+00:00 2026-05-14T07:01:05+00:00

I have an if statement that needs to look like this: UPDATE $(input#textbox).keypress(function(e){ key==e.which;

  • 0

I have an if statement that needs to look like this:
UPDATE

 $("input#textbox").keypress(function(e){
    key==e.which;
    if($("input#textbox").length <=7 && (key===13 || $("div#search-button").click())){
       /////SOME FUNCTION////
    };
 });

I’m trying to execute the “SOME FUNCTION” area only if the input length is <=7 and either the enter button is pressed or the “search” button is clicked.

Furthermore, I want to combine these 2 different function initiators so that they execute the same function but don’t know how to do it:

  $("input#textbox").keypress(function(e){
     FUNCTION A
  };

  AND 

  $("div#search-button").click(function(){
     FUNCTION A
  };
  • 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-14T07:01:06+00:00Added an answer on May 14, 2026 at 7:01 am

    EDIT:

    This is what you have to do:

    1. I am assuming that you want the text length and not number of textboxes.
    2. You want to execute FunctionA when enter is pressed on textbox or search button is clicked:
    
         $("input#textbox").keypress(function(e){
            key==e.which;
            if (key === 13) // if enter is pressed
            {
               if ("#textbox").val().length >= 7) //if textbox has more than 7 characters
               {
                   functionA();
               }
            }
         });
         $("div#search-button").click(function(){ functionA();});
    

    HTH

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

Sidebar

Related Questions

I have LINQ statement that looks like this: return ( from c in customers
In an Oracle 10g environment, I have a statement that needs to be executed
I have a SQL statement that looks like: SELECT [Phone] FROM [Table] WHERE (
I have this query statement and want to only get records that has a
I have a delete statement that's going against one of my core application tables.
Suppose I have a SELECT statement that returns some set of results. Is there
Let's say I have an SQL statement that's syntactically and semantically correct so it
I have an annoying SQL statement that seem simple but it looks awfull. I
I have a long running SQL statement that I want to run, and no
I'm learning about DDD, and have come across the statement that value-objects should be

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.