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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:21:25+00:00 2026-06-09T22:21:25+00:00

I am having variables that reference html ID’s like <div data-role=footer id=ftrPaxFlight> <h4>&#169; 2012,

  • 0

I am having variables that reference html ID’s like

<div data-role="footer" id="ftrPaxFlight">
    <h4>&#169; 2012, BT</h4>
</div>

and I am having a javascript embedded in html using jQuery which is like

<script>
  $(document).ready(function() {
            var ftrPaxFlight = $('#ftrPaxFlight');
    var butMainLogin = $('#butMainLogin');
    var butMainSetup = $('#butMainSetup'); 
       .....
      butMainLogin.bind("click", function() {
           getChangeFtr();
    });

Where getChangeFtr is a function located in an external .js file. I want to seperate the logic from UI. This file is also included under tags

function getChangeFtr(){
     alert("Ftr will be changed " + ftrPaxFlight);
 }

When the button is clicked .. the method getChangeFtr() is called, I am getting an error

TypeError – ftrPaxFlight is undefined.

Can someone guide me to the right way of passing variables to multiple javascript files using jQuery?

  • 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-06-09T22:21:27+00:00Added an answer on June 9, 2026 at 10:21 pm

    There are many ways of doing this, and there is no “right way”. You can use global variables, a global namespace/singleton or simply pass objects between functions using arguments. In your case I would use arguments:

    function getChangeFtr( elem ){
        alert("Ftr will be changed " + elem);
    }
    

    And:

    butMainLogin.bind("click",function() {
        getChangeFtr( ftrPaxFlight );
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read in various places that having variables with global scope, i.e. a
I am having trouble with a few of the variables that the Net-SNMP library
I'm having some troubles using Session Variables as they are being used as Reference
Is there a way to get around having to reference Global variables inside a
I am having this issue. I have a script that checks if variable exists,
I'm having trouble using variables in my SQL WHERE clause. I'm getting this error:
I'm essentially having difficulty pass dynamic variables to a view. I have php functions
I am having trouble with passing some variables through a method and then having
I am having some trouble comparing two variables, hope someone could help. Basically what
Question: I am having issues passing session variables from parent page to iFrame page

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.