jquery - Javascript is not rendering in my SPA -
i have following written in home.js file:
define(['services/logger'], function (logger) { var vm = { activate: activate, title: 'home view' }; return vm; //#region internal methods function activate() { logger.log('home view activated', null, 'home', true); return true; } //#endregion var editor, html = ''; function createeditor() { if (editor) return; // create new editor inside <div id="editor">, setting value html var config = {}; editor = ckeditor.appendto('editor', config, html); } function removeeditor() { if (!editor) return; // retrieve editor contents. in ajax application, data // sent server or used in other way. document.getelementbyid('editorcontents').innerhtml = html = editor.getdata(); document.getelementbyid('contents').style.display = ''; // destroy editor. editor.destroy(); editor = null; } function multiselect() { ("#sites").multiselect(); } });
my home.html file contains following:
<section> <h2 class="page-title" data-bind="text: title"></h2> </section> <section id ="recipients"> <article> <div class="row"> <div class="span6"> <label for="study">study: </label> <ul class="dropdown-menu" id="study"></ul><br /> <label for="sites">sites: </label> <ul class="dropdown-menu" data-bind="text: sites" title="sites" id="sites" ></ul><br /> <label for="distribution">distribution: </label> <input type="checkbox" data-bind="text: distribution" title="distribution" /> </div><!-- span6 --> </div><!-- row --> <div class="row"> <div class="span6"> <label for="recipients">recipients: </label> <input type="checkbox" data-bind="text: recipients" title="recipients"/><br /> </div><!-- span8 --> </div><!-- row --> </article> </section> <section id ="communication"> <article> <label for="sendfrom">send from: </label> <label id="sendfrom"></label><br /> <label for="subject">subject: </label> <input id="subject" /><br /> <div id="editor"> </div> </article> </section>
the bootstrap classes not rendering layout i've specified. additionally, jquery multi select , ckeditor not rendering either. i've double checked solution file contains jquery, bootstrap etc. other things need change ensure javascript rendered correctly?
it looks me module definition function returning (return vm;) before other functions being defined.
move vm creation , return statements below other functions , should start see expected behaviour.
it's not best practice though, evan said should leverage viewattached lifecycle function manipulating dom.
Comments
Post a Comment