1
$(function(){
  window.Placements = Backbone.View.extend({
    el: $("#app"),
    events: {
      "submit form": "updatePlacement"
    },
    updatePlacement: function(e) {
      e.preventDefault();
      alert('foo');
    }
  });
  window.App = new Placements;
})

Running results in:

TypeError: Result of expression '$(this.el).delegate' [undefined] is not a function.

3 Answers 3

3

I was using jquery 1.3.2 but backbone requires a later version (no version number is mentioned in the docs)

Sign up to request clarification or add additional context in comments.

1 Comment

Backbone lists jQuery 1.4.2 in it's "Downloads & Dependencies" section.
1

I think it's because you are setting el: $("#app"), and then you try to get again $(this.el) while in this.el you already have the HTML object $(#app). Try to put el: '#app' and see what happens.

Comments

0

I think there may be a typo in you events object:

event types should be first:

submit form instead of form submit

3 Comments

You're right, I've changed this but I still get the same error message
Have you tried with an initialize method : _.bindAll(this, 'render') ?
Tried that just now but it doesn't make any difference

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.