Note that there are some explanatory texts on larger screens.

plurals
  1. PObackbone view not rendering on pagecreate event
    text
    copied!<p>Am building a mobile web app with jquery mobile, backbone, and require.js to make it modular. I have an html page that has this;</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8"&gt; &lt;title&gt;DoIt&lt;/title&gt; &lt;link href="jqm/jquery.mobile-1.2.0.css" rel="stylesheet"&gt; &lt;script charset="utf-8" src="jqm/jquery-1.7.2.min.js"&gt;&lt;/script&gt; &lt;script charset="utf-8" src="jqm/jquery.mobile-1.2.0.min.js"&gt;&lt;/script&gt; &lt;script charset="utf-8" src="libs/require.js" data-main="app"&gt;&lt;/script&gt; &lt;/head&gt; </code></pre> <p>my app.js file looks like this</p> <pre><code>//Require.js configuration require.config({ paths: { 'underscore': 'libs/underscore-min', 'backbone': 'libs/backbone-min', 'text': 'libs/text' }, shim: { 'backbone': { deps: ['underscore'], exports: 'Backbone' } } }); require(['backbone', 'views/main'], function (Backbone, AppView) { 'use strict'; var view = new AppView(); $(document).bind('pagecreate', function () { view.render(); }); }); </code></pre> <p>and this the template for the view</p> <pre><code> &lt;script type="text/html" id="app-view-tmpl"&gt; &lt;div id="task-creator"&gt; &lt;input type="text" id="task" placeholder="Enter a task"&gt; &lt;button data-role="button" data-theme="b"&gt; Create task &lt;/button&gt; &lt;/div&gt; &lt;/script&gt; </code></pre> <p>I using the 'pagecreate' event to trigger the rendering of the view. The view doesnt render but other details i set to be logged to the console on initialization of the view are logged. Am doing something wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload