问题
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