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

  • Home
  • SEARCH
  • 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 7075069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:08:00+00:00 2026-05-28T06:08:00+00:00

I have a variable being set in a plugin JS file, and in my

  • 0

I have a variable being set in a plugin JS file, and in my own custom JS file, I’m calling the same event to piggypack on the developers work.

The issue is I need to access a variable set in the plugin javascript event. It’s currently being set as follows in the plugin JS:

$('#link').live('click', function() {
  var test = 123456;
  var another = 'string';

  $('body').trigger({
    'test' : test,
    'another' : another
  });
});

Now, in my own custom JS, I’m calling the same method on the #link to add my own code to execute.

$('#link').on('click', function(){
  // I need to access the another variable set previously
});

What I don’t really get is when the jquery docs say that the trigger method is passing arguments to the event handler. What does that mean exactly? How would I access the variable set in a previous event?

Thanks in advance as always.

  • 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-28T06:08:00+00:00Added an answer on May 28, 2026 at 6:08 am

    NORMALLY, you would pass extra parameters to an event, IF it has a custom event, you can access that:

    $('#link').live('click', function() {
        var test = 123456;
        var another = 'string';
        $('body').trigger('HIT',{
            'test': test,
            'another': another
        });
    });
    
    $('body').on('HIT', function(e,param1) {
        $('#hitter').append('hi');
        $('#hitter').append(param1.test);
    });
    

    after this HIT event, the value of #hitter would have “hi123456” appended to it. To access the “another” is simply param1.another, which returns “string”.

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

Sidebar

Related Questions

I have the following variable being dynamically set by user generated content: $variable =
I have a page and there is a public variable that is being set
In my C# code-behind for an ASP.Net app, I have a variable being set
I have a variable that's being changed all the time in the course of
I have a Python script and I am trying to set a variable so
I have a variable int nextvalue. This is set via nextvalue = b.getInt(b.getColumnIndex(nextq)); It
I have an env var that's being set(PYTHONPATH) whenever I open a new Bash
I have variable @count of datatype int.I am setting values to this @count. I
If I have variable of type IEnumerable<List<string>> is there a LINQ statement or lambda
How I can have variable number of parameters in my function in C++. Analog

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.