Jquery 在iOS中开发cordova应用程序,标签循环

Jquery 在iOS中开发cordova应用程序,标签循环,jquery,html,css,cordova,Jquery,Html,Css,Cordova,大家好,我是一名本地iOS开发人员,我正在使用web技术开发混合应用程序。我正在jQuery中创建一个动态div,从ajax调用中获取rjson数据。因此,我在页面上填充问题列表,每个问题都有问题标题、视图数量、答案数量、投票数量和标签。我的标签的问题是,如果有两个标签,它在同一个跨度内,当我尝试循环跨度时,它将每个字母表视为一个单独的标签,并保留标签。例如,如果第一个问题有一个标签,第二个问题将有第一个问题标签和它自己的标签。任何帮助都将不胜感激 if(rjson != null ){ if

大家好,我是一名本地iOS开发人员,我正在使用web技术开发混合应用程序。我正在jQuery中创建一个动态div,从ajax调用中获取rjson数据。因此,我在页面上填充问题列表,每个问题都有问题标题、视图数量、答案数量、投票数量和标签。我的标签的问题是,如果有两个标签,它在同一个跨度内,当我尝试循环跨度时,它将每个字母表视为一个单独的标签,并保留标签。例如,如果第一个问题有一个标签,第二个问题将有第一个问题标签和它自己的标签。任何帮助都将不胜感激

 if(rjson != null ){
if(rjson.length)
{
   var htmlString = '';
   var tags  = "";
   for(i=0; i<rjson.length;i++){  
      var jsontitle=rjson[i].title.toLowerCase();
/*this is for search input*/
      if(jsontitle.search(valThis) != -1 )
/**/
         continue;
      htmlString = htmlString + '<div class="kmforum_body_area_row" style="overflow-x:hidden; position : relative; width:100%; float:left; "><div style="width:100%; height:auto; float:left;"></div>';

      htmlString = htmlString + '<div id="oppToggle'+ count +'" class="toggle" style=" width:99%; padding:10px; float:left; margin: 0; ">'+
               '<div style="width:87%; height:auto; float:left;" onclick=kmforumAnswerList($("#groupid'+i+'").val(),$("#questiontext'+i+'").val(),$("#questiontitle'+i+'").val(),$("#questiontags'+i+'").val(),$("#questionscore'+i+'").val());>'+

               '<div  style="float:left; padding-left:10px;'+ 'font-size:12px; width: 95%;">'+
               '<div  style="font-weight:bold; font-size:14px; text-shadow:none; height: auto; color:#336699;'+
               ' width:100%;">'+  rjson[i].title + '<input id="groupid'+i+'" type="hidden"  value="'+ rjson[i].id +'"></input>' + 
               '<input id="questiontext'+i+'" type="hidden"  value="'+ rjson[i].QuestionText +'"></input>' +
               '<input id="questiontitle'+i+'" type="hidden"  value="'+ rjson[i].title +'"></input>' +
               '<input id="questiontags'+i+'"  type="hidden"  value="'+ rjson[i].tagnames +'"></input>' +
               '<input id="questionscore'+i+'"  type="hidden"  value="'+ rjson[i].score +'"></input>' +

               '</div>'+
              '<div style="color:black;  white-space: nowrap; text-shadow:none; overflow: hidden;'+
              'text-overflow: ellipsis; width:100%;">'+  rjson[i].score +' votes ' +rjson[i].view + ' views ' + rjson[i].ans_count + ' answers '+ '</div>'+
      '<div style="float:left; padding-left:3px;">' ;
/*this is for looping spans*/
              for(j=0; j < rjson[i].tagnames.length; j++){
         tags +='<span style="float:left; margin:0 auto; border-radius: 5px; background-color:#A9F5F2; white-space: nowrap; text-shadow:none; overflow: hidden;">'+  rjson[i].tagnames[j] + '</span>'  ;
      }

      htmlString +=tags+'</div>'+
              '<div style="width:35%; font-size:10px; float:right; color:#000000; white-space: nowrap; text-shadow:none; overflow: hidden;'+
              'text-overflow: ellipsis;">'+ rjson[i].author_name +'</div>'+
              '</div>'+

               '</div></div>'+
               '</div></div>';
      $('#iddivtitlelistcontent').html(htmlString);
            count = count + 1;

   }               

}

这就是我正在使用的代码。

你能给我一个JSFIDLE吗?很抱歉,我没有,我真的不太确定它是什么?正如我提到的,我是本地iOS开发者,对JS及其框架不太熟悉。ThanksJS Fiddle在这里,您可以发布您的JS代码,如果需要还可以发布html/css,以便其他人查看您的实际代码并尝试解决您的问题。