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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:52:13+00:00 2026-05-15T23:52:13+00:00

I am defining function func1(); I want it to take some param(s) ie var

  • 0

I am defining function func1();
I want it to take some param(s) ie

var func1(aaa, bbb){
//do something, anything!
};

then i want to call it later in the doc something like this:

$('#some_id').click(func1($this));

but its not working.

I’ve been messing with it for a while but its very strange the way jquery/javascript handles user defined functions to me at least. Can some1 provide me with simple code snippet? Thx

  • 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-15T23:52:14+00:00Added an answer on May 15, 2026 at 11:52 pm

    If all you want to pass is $(this), you don’t need the parameter, as it will be available inside the defined function.

    $('#some_id').click(func1);
    

    However, you can’t add parameters like this:

    $('#some_id').click(func1(param1, param2));
    

    Then, for your function definition, you just have

    function func1() { }
    

    If you do want parameters other than $(this), you will need to do the following:

    $('#some_id').click(function () {
        func1(aaa, bbb); });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

it may be a duplicate of How to dynamically call a class' method in
template <class T> class Test { public: template<class U> void f(); //generic function template<>
I'm curious about the technical reason for cin.getline and the global getline function being
I have the following simple function: public class BaseEntityRepository<TEntity, TId> : IBaseEntityRepository<TEntity, TId> where
I've been looking at the GCC docs for defining macros and it looks like
In Haskell, is it possible to write a function with a signature that can
I'm trying to learn ExtJS and object-oriented JavaScript in general. I've seen people defining
So, I have a Wordpress theme. In the functions.php file, I'm writing a function
I've been fighting with this for a few days now and it looks like
I've built a CMS for our company which has a huge number of functions,

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.