1
我已經在HTML文件中直接硬編碼了Div內的jQuery Mobile Button並且它正確顯示。請在下面找到jQuery Mobile Listview按鈕不可見
像但當我通過JavaScript修改它這兩個按鈕就消失了。不知道爲什麼。請在下面找到
圖像這可能是因爲jQuery Mobile的列表視圖的動態刪除某些款式的東西?
這是HTML
<div data-role="content" data-theme="c">
<div id="ListOfCals">
<ul data-role="listview">
<li data-icon='false'>
<div id='ColorCodeDiv' style='background-color:#FFF;'></div>
Calendar 2
<p style='margin-top:2px'><strong><font size='2' color='#006600'>Active</font></strong></p>
<div id='calendarListView'>
<a name='del' data-role='button' href='#' data-icon='delete' data-theme='g' data-iconpos='notext' data-inline='true' data-bttype='delete'></a>
<a name='del' data-role='button' href='#' data-icon='gear' data-theme='e' data-iconpos='notext' data-inline='true' data-bttype='edit'></a>
</div>
</li>
</ul>
</div>
這是JavaScript代碼使用
var strCalList = "<ul data-role='listview'>";
var ListOfCals = JSON.parse(data.d);
$(ListOfCals).each(function(){
strCalList +="<li data-icon='false'>";
strCalList += "<div id='ColorCodeDiv' style='background-color:"+$.trim(this.ColorCode)+"'></div>"
strCalList += this.CalendarName;
if(this.Active==true){
strCalList +="<p style='margin-top:2px'><strong><font size='2' color='#006600'>Active</font></strong></p>" ;
}
else if(this.Active==false){
strCalList +="<p style='margin-top:2px'><strong><font size='2' color='#FF0000'>Inactive</font></strong></p>";
}
strCalList +="<div id='dvBtn'>";
strCalList += "<a name='del' data-role='button' href='#' data-icon='gear' data-theme='e' data-iconpos='notext' data-inline='true' data-bttype='edit' ></a>";
strCalList +="<a name='del' data-role='button' href='#' data-icon='delete' data-theme='g' data-iconpos='notext' data-inline='true' data-bttype='delete'></a>";
strCalList +="</div>";
strCalList +="</li>";
});
strCalList = strCalList+"</ul>";
$('#ListOfCals').html(strCalList);
$('#ListOfCals ul').listview();
有人能弄清楚爲什麼?提前感謝您的時間。