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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:04:44+00:00 2026-05-16T01:04:44+00:00

hey, Im trying to make a call a jquery function and pass some args

  • 0

hey, Im trying to make a call a jquery function and pass some args with it in the form of

$('#button').mouseenter(exampleFunction(arg1,arg2));

function exampleFunction(arg1,arg2)

The function works fine with no args written like this.

$('#button').mouseenter(exampleFunction);

function exampleFunction;

but as soon as i add () to put args in the function stops working.

like this:

$('#button').mouseenter(exampleFunction());

It seems like this is some sort of jquery syntax error on my part

here’s the actual code

    <script type="text/javascript">

$(document).ready(function() {
$('.section').mouseover(function(){
  $('#nav2').fadeOut(0).animate({"height":"30px"}, 250);

         });


$('#section1').hover(navSelect);

function navSelect(){
  if ( $('.interior').is(':hidden')){
  $('.subSection').fadeOut(250);
  $('.interior').delay(250).fadeIn(250);
  $('#selector').animate({"left":"0px"},250);
  }}


$('#section2').mouseenter(function(){
  if ( $('.exterior').is(':hidden')){

  $('.subSection').fadeOut(250);
  $('.exterior').delay(250).fadeIn(250);
  $('#selector').animate({"left":"100px"},250);
  }
});
$('#section3').mouseenter(function(){
  if ( $('.view').is(':hidden')){

  $('.subSection').fadeOut(250);
  $('.view').delay(250).fadeIn(250);
  $('#selector').animate({"left":"200px"},250);
  }
});


         });
</script>
  • 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-16T01:04:44+00:00Added an answer on May 16, 2026 at 1:04 am

    the function you bind to on an event in jQuery is passed the ‘event’ object from jQuery’s invocation of the method.


    jQuery("#button").mouseenter(function(evt){[ do something ]});

    if you want to do something like


    $('#button').mouseenter(exampleFunction(arg1,arg2));

    in order to templatize a function that you want to have bound to the event, you could construct a function like so:


    function exampleFunction(arg1, arg2){
            return function(evt){
                jQuery(this).animate({width: arg1, height: arg2},250)
            };
    }};

    having it return the function that is bound (and thus, passed the event object),
    and then bind it to elements like


    jQuery("#button").mouseenter(exampleFunction("50%","50%"))
            .mouseleave(exampleFunction("100%","100%");

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

Sidebar

Related Questions

Hey I am trying to make a page that inserts some strings into a
hey guys, im trying to make a volunteer form, that takes info such as
Hey I'm trying to make a clear button for my polish calculator.. code give
Hey so i'm trying to make a function that takes in an image refrence
Hey everyone. I'm trying to make a swing GUI with a button and a
Hey i'm trying to make a Button template class, which is constructed with the
Hey i'm trying to make my website delete a file using the unlink(); function.
I need some help guys, trying to make this test to pass but with
Hey I am trying to make a dungeon crawler and I am stuck on
Hey all I'm trying to make a 3d game in with 2d sprite characters.

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.