javascript - How Do I Show All Of The List Title In That Div? -


<script type="text/javascript">     window.onload = function() {         executeordelayuntilscriptloaded(viewitem, 'sp.js');     };      function viewitem() {          var ctx = new sp.clientcontext.get_current();         this.listcoll = ctx.get_web().get_lists();         ctx.load(this.listcoll);         ctx.executequeryasync(function.createdelegate(this, this.onsuccess), function.createdelegate(this, this.onfail));     }      function onsuccess(sender, args) {         var listenum = this.listcoll.getenumerator();         while (listenum.movenext()) {             var olist = listenum.get_current();             document.getelementbyid('resultpanel').innerhtml = olist.get_title();         }     }      function onfail(sender, args) {         alert('fail!');     } </script> <div id="resultpanel"> </div> 

the question bit cryptic text in title , code in body. suggest go through - how ask question?

now coming answer. if guess right 'that div' mean <div id="resultpanel"></div> , assuming code working show title of 1 list have rework code this:

var titleoflists = ""; while (listenum.movenext()) {     var olist = listenum.get_current();     titleoflists = titleoflists + olist.get_title() + ", "; } document.getelementbyid('resultpanel').innerhtml = titleoflists; 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -