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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:28:36+00:00 2026-05-12T22:28:36+00:00

I am trying to bind an event to a textbox that contains parameters. The

  • 0

I am trying to bind an event to a textbox that contains parameters. The following keep looks as if it should do it, but every time the page loads, it gets executed.

jQuery(function(){
    jQuery('#textbox').bind('click', EventWithParam('param'));
});

The event gets called with that parameter every time the page loads. This may not work because events with parameters are not supported. If so, is there another route?

  • 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-12T22:28:37+00:00Added an answer on May 12, 2026 at 10:28 pm

    To bind a function that takes parameters, use an anonymous function to act as a closure over the parameters.

    jQuery(function($) {
        var param = 'text';
        $('#textbox').click(function() {
            EventWithParam(param);
            // or just use it without calling out to another function
            $(this).text(param);
        });
    });
    

    Your example is executing the EventWithParam function, and then trying to bind to the result of that function call.

    Calling unbind without specifying a function will unbind all handlers for the specified type of event (including the anonymous function). If you want to unbind that function specifically, you’ll need to provide it with a name, like this:

    jQuery(function($) {
        var param = 'text',
            clickCallback = function() {
                EventWithParam(param);
                // or just use it without calling out to another function
                $(this).text(param);
            };
        $('#textbox').click(clickCallback);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to bind an event to the touchstart, touchmove, and touchend properties that
Im using JQuery UI Selectmenu widget - http://wiki.jqueryui.com/w/page/12138056/Selectmenu Im trying to bind change event.
I am trying to bind an event to all dialogs that have been created
I'm trying to bind a click event handler to some elements that are being
I have an unordered list (UL) that I'm trying to bind a mouseover/mouseenter event
I am trying to bind a blur and keyup event handler to a textbox;
I'm trying to bind change event to model, but is not working. Here is
I'm trying to bind an onChange event to 7 dropdowns inside a loop. But
I am trying to bind an event to a method of a particular instance
i am trying to bind an event to a dynamically created div. function GameField(playerNumber)

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.