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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:06:13+00:00 2026-05-21T02:06:13+00:00

Today I came across a bug in my web app regarding form search submit

  • 0

Today I came across a bug in my web app regarding form search submit function (in js) and a button click action in jQuery.

I have a form that has the action submitEmpSearch() attached to it. This is embedded in the html of the form as it’s onSubmit action. There is also a search button associated with the form with an onclick event submitEmpSearch(). I was making an attempt to clear out embedded javascript from the templates in favor of jQuery calls. In an included jQuery call I had the call $('#search-button').click( submitEmpSearch() ) inside my $(document).ready group.

From my previous experience with the .click() function, I expected this to have the same functionality as the embedded onclick attribute provided. However, instead, it gave the page an infinite loop of (apparently) clicking the button as soon as it loaded!

Now, previously, I always passed a function() {} pattern. I had never passed in a predefined function before. Is this some kind of gotcha in the jQuery language framework? Or is there something else I’m doing wrong?

  • 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-21T02:06:14+00:00Added an answer on May 21, 2026 at 2:06 am

    jQuery is not a language. JavaScript is the language. You’re passing the result of the function, when you want to pass the function itself:

    It should be:

    $('#search-button').click(submitEmpSearch)
    

    In JavaScript, functions can be passed as values. However, submitEmpSearch() is the return value of a call to the function, as one would expect from other languages.

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

Sidebar

Related Questions

So I came across an interesting problem today. We have a WCF web service
I was refactoring some code in a web application today and came across something
Today I came across a problem where someone had accidentally committed a proj.user file
I came across this code today AsyncInvoke(OnTimeMessageTimer, (object)null, (ElapsedEventArgs)null); Is there anything wrong with
Came across this error today. Wondering if anyone can tell me what it means:
Today at work we came across the following code (some of you might recognize
I came across a strange behaviour when doing some regular expressions in JavaScript today
At work today, I came across the volatile keyword in Java. Not being very
Today, I came across quite strange problem. I needed to calculate string length of
Today i came across nested functions which i had never heard of. Is it

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.