javascript - Backbone.js Firefox issue -


hello using backbone.js + require.js application have problem rendering template in firefox. works fine in chrome , ie

here code render

define([   'jquery',   'underscore',   'backbone',   'text!templates/home/main.html' ], function ($, _, backbone, mainhometemplate) {      var mainhomeview = backbone.view.extend({         el: $("#page"),         render: function () { //            console.log("loading template");             this.el.html(mainhometemplate);         }     });     return new mainhomeview; }); 

can 1 let me know whats issue

thanks in advance

this.el reference raw dom element of view. guess chrome must have html method on raw dom elements, (evidently) firefox doesn't.

in case, want jquery-wrapped version of same element, can using this.$el. if reason you're using older version of backbone ($el added recently) can instead $(this.el); work same, it's less convenient.

if use jquery-wrapped version of element, .html(mainhometemplate) call work, because jquery objects have "html" method.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -