How can i get the item to count in span?

只愿长相守 提交于 2020-01-06 08:17:08

问题


I want to show the numbers of total what showing in the string htmlresult in Span class. I dont get it to work. Please help.

 var htmlResult = '<a href="#popupBasic" id="popupBasicLink" data-close- 
 btn="right" data-transition="flip" data-rel="popup" class="ui-btn ui-corner- 
 all ui-shadow ui-icon-info ui-btn-icon-left" data- 
 transition="pop">Trafikmeddelanden<span class="ui-li-count" id="count"> 
 </span></a>';

htmlResult = htmlResult + '<div data-role="popup" id="popupBasic">';

var reasoncode = item.ReasonCodeText;

matched = item.ReasonCodeText
$("count").html(matched.length);

htmlResult = htmlResult   + reasonCodeText.toUpperCase().bold() + '</b> 
<p>Starttid: ' + outputDate + ' ' + hours + ':' + minutes + 
' - Uppdaterad: ' + outputDate2 + ' ' + hours2 + ':' + minutes2 + 
'<br />' + externalDescription + '</p>'; 

The item.ReasonCodeText is from the Swedish trafikverkets API to get traffic announcement for train. The item.ReasonCodeText can include several items. I want to get all items to be counted.

来源:https://stackoverflow.com/questions/57008690/how-can-i-get-the-item-to-count-in-span

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!