javascript - How to create mutliple spans from within a Backbone view -


i have a collection of model data need render inside div this:

_.each(model.stages, function(stagesdata){                     this.$('.stagedate').text(stagesdata.get('status'));                     this.$('.stagestatus').text(stagesdata.get('timestamp'));                 }); 

this html i'm trying render data:

 <span class="stagedate"></span>  <span class="stagestatus"></span> 

now what's happening right shows last item inside model in view , not all. know because loop overwrites created span, wanted understand way go it? please suggest!

instead of text():

this.$('.stagedate').text(stagesdata.get('status')); 

use append():

this.$('.stagedate').append('</p>' + stagesdata.get('status') + '</p>'); 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -