node.js - TypeError: n is undefined in underscore template -


i using underscore temperating in jade.

index.jade

extends layout block content   .wrap     .container-fluid#container   script(type='text/template' id='main-template')   .row         .col-xs-8.col-sm-9           .heading h2 welcome node chatroom           hr/           .content             ul.list-group#chatlist         .col-xs-4.col-sm-3           .sidepanel             .panel-heading               h3.panel-title online users                 span.badge pull-right#usercount             hr/             .panel-body               ul.list-group#userlist              .push   .footer     .container-fluid       .row         form           .form-group             .col-xs-8.col-sm-9               input(type="text" id="chatinput" class="form-control input-lg" placeholder="write message here..." rows="3")             .col-xs-4.col-sm-3               button(id="send-message-btn" class="btn btn-primary btn-lg btn-block" type="submit") send message  script(type='text/template' id='login-template')   .row     .col-md-4.col-md-offset-4.text-center       .login         .form-group           label enter name           input(type="text" class="form-control" id="nametext")           .btn-group             button(id="name" type="button" class="btn btn-primary btn-lg") login 

main.js

var loginview = backbone.view.extend({     template: _.template($('#login-template').html()),       events: {         'click #name': 'onlogin'     },      initialize: function(options) {     this.vent = options.vent;      this.listento(this.model, "change:error", this.render, this);     },      render: function() {         this.$el.html(this.template(this.model.tojson()));      onlogin: function() {     //this.l.start();     this.vent.trigger("login", this.$('#nametext').val());     } }); 

it showing typeerror: n undefined on line template: _.template($('#login-template').html()),

i have tried using . after script proposed in jade doc . didn't work.

looks underscore cant access #login-template id. reason why?


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -