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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:17:35+00:00 2026-06-18T10:17:35+00:00

I am currently writing a Backbone app and have got stuck on what seems

  • 0

I am currently writing a Backbone app and have got stuck on what seems to be a very simple problem but cannot seem to work it out.

Let’s say I have a view like this (demo code)

var View = Backbone.View.extend({
    initialize: function () {
         console.log('created a view');
    },
    events: {
         'click button':'buttonClicked',
         'click link':'linkClicked'
    },
    buttonClicked: function (event) {
         // I would like to store the event and pass this to the 
         // linkClicked function below when the linkClicked function is called 
         var $currentEvent = $(event.currentTarget);
    },
    linkClicked: function () {
         // When the link is clicked I would like to gain access to $currentEvent
    }
});

I would like to pass the variable $currentEvent to the function linkClicked when the link is clicked. Would it be best to store this in the model or can I pass the variable around the view.

Any help on this would be great!

Thanks

  • 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-18T10:17:36+00:00Added an answer on June 18, 2026 at 10:17 am

    You can do something like this:

    initialize: function () {
         /** Initialize the variable when View is first created. */
         this.currentEvent = 'something'; 
    },
    buttonClicked: function (event) {
         /** Assign variable when button is clicked. */
         this.currentEvent = $(event.currentTarget);
    },
    linkClicked: function () {
         /** Receive the value of the variable and output it. */
         console.log(this.currentEvent);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing a simple app that performs a series of requests to the
I am currently writing a simple IOS app that saves tasks into a table.
I am currently writing a Java EE web-app using JSP's and I have a
I'm currently writing a Backbone Marionette app which ultimately amounts to about 6 different
I'm currently writing a small test Android app, and have run across a small
I am currently writing a Java compiler and have implemented section 15.12.2.7. of the
I'm currently writing an app that has a calendar as one of it's screens.
I'm currently writing an OpenCL kernel (but I suppose that in CUDA in will
Currently writing an app that should be able to quicklook webarchive. Copied data from
I'm currently writing a C# console app that generates a number of URLs that

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.