Take the 2-minute tour ×

I am creating a subView which is rendered from the mainview - FindRideView.

renderRide: function (item) {
        var RideView = new RideView({model: item}); // here

However when i render the view,
i get a Uncaught TypeError: undefined is not a function //here

My app structure is

 var RideView = Backbone.View.extend({});
 var FindRideView = Backbone.View.extend({

I checked with the RideView for any errors. But its working completely fine when not called from the FindRideView. I guess there might be some scope issue, but i am not sure about it. Would appreciate some help.

share|improve this question
Your code seems fine, can you try to recreate your problem in a JSFiddle? –  nemesv Feb 6 '13 at 7:02
Try naming your instance something other than RideView since that is the exact same as your constructor. –  Paul Hoenecke Feb 6 '13 at 7:05
nialed it!! haha! renaming it to something else did the trick :) thanks –  Himanshu Soni Feb 6 '13 at 7:06
add comment

1 Answer

Try defining "RideView" outside of the function. See this for a scoping example:


var mynum;
mynum = 1;
function DontSetMyNum() {
    var mynum;
    mynum = 2;
function SetMyNum() {
    mynum = 3;
$(function() {
    $("body").append("<p>Initial = " + mynum + "</p>");
    $("body").append("<p>After DontSetMyNum call = " + mynum + "</p>");
    $("body").append("<p>After SetMyNum call = " + mynum + "</p>");
share|improve this answer
add comment

Your Answer


