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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:15:08+00:00 2026-05-26T05:15:08+00:00

I have a view. //define View var CreatePollView = Backbone.View.extend({ events: { click #addOption:

  • 0

I have a view.

//define View
var CreatePollView = Backbone.View.extend({
    events: {
        "click #addOption": "addOption",
        "change .dynamicInput": "changeInputs"
    },
    initialize: function () {
        _.bindAll(this, "render", "addOption", "changeInputs");
        this.model.bind('change', this.render);
    },
    changeInputs: function () {
        var newVal = $(this).val(); // this throws exception in jquery script
        this.model.set("Subject", { Subject: newVal });
    }, ....

How can I access the element (it is an input element) on which the change event was triggered?

  • 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-26T05:15:09+00:00Added an answer on May 26, 2026 at 5:15 am

    You are getting an exception because you are calling _.bindAll on changeInputs. When you do that, you are saying that changeInputs will be bound to your object’s context whenever it gets called.

    In other words, when you refer to $(this) you are sending an instance of CreatePollView into jQuery, which it doesn’t like.

    You want to keep this binding, though, because you are accessing your model (this.model) so this needs to be the instance of CreatePollView.

    Instead, you can get an event from your function and use the target or some other piece of information:

    changeInputs: function(e) { }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this: var SomeNamespace = { Model: Backbone.Model.extend(), View: Backbone.View.extend({ model: new this.Model,
I have a controller with store, model and view (toolbar) : Ext.define('Cc.controller.Headers', { extend:
I have two backbone Views. One is the main view and the other is
I have a tree view defined as follows: <HierarchicalDataTemplate x:Key=ChildTemplate ItemsSource={Binding Children}> <TextBlock Text={Binding
I have defined my binding thus: <TreeView ItemsSource={Binding UsersView.View} ItemTemplate={StaticResource MyDataTemplate} /> The CollectionViewSource
I have an ASP.NET MVC view which contains checkboxes for user-defined categories. <td><% foreach
i have view like 'home/details/5', it can be access by anonymous user. but there
I have view controller, into the view i have put a table view, and
I have a view that has a list of jobs in it, with data
I have a view using a master page that contains some javascript that needs

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.