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
I have the following statement that I need to run on a table which
I have a statement similar to this that I need to run in Linq.
I have an UPDATE statement that's intended to update a status field for a
I have a sql statement that uses Difference => http://msdn.microsoft.com/en-us/library/ms188753.aspx I do this in
I have an IF statement that consists of two separate function calls passing values
I have a stored procedure that uses this select statement: SELECT dbo.VendorProgram.id, dbo.VendorProgram.CODE, dbo.Programs.ProgramName
I have a function that needs to return a sorted list based on some
I have a table code_prices that looks something like this: CODE | DATE |
I have an XML variable that looks like this: <code> <IDs> <ID id=1>a</ID> <ID

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.