我将 Collapsible Accordion 用于动态附加的列表。每个可折叠项都应该有一些表单元素(文本输入、文本区域和按钮),如下图所示。
我的问题是,当可折叠手风琴动态附加时,没有样式附加到动态附加的表单元素上。
我试过$(‘#PageID’).page()
但没有运气。
我的代码
var projectListStr = "<div data-role='collapsible-set' data-theme='c' data-content-theme='d' id='collabsibleProjectList' data-inset='false'>";
$.each(projectList,function(index, value){
LineOneprojectListStr = "<br/><p class='listP2'><strong>Aktivitet </strong>: "+CheckNullToEmptyString(this.ActivityName)+"</p>";
LineOneprojectListStr += "<br/><p class='listP3'><strong>Händelse/Verksamhet</strong>: "+CheckNullToEmptyString(this.EventName)+"</p>";
projectListStr += "<div data-role='collapsible' class='myset'>";
projectListStr += "<h3>"+this.ProjectName+"<span class='ui-li-count'>"+checkNullToZero(this.Days[i].EventTimant2)+"</span>"+LineOneprojectListStr+"</h3>";
FormStr = "<table align='center'>";
FormStr += "<tr><th>Hours</th><th>Minutes</th></tr>";
FormStr += "<tr><td><input type='number' name='hoursMon' id='hoursMon' value='' /> </td><td><input type='number' name='minsMon' id='minsMon' value='' /></td></tr>";
FormStr += "</table>";
FormStr += "<div data-role='fieldcontain' >";
FormStr += "<label for='externalNotesMon'>Fakturatext</label>";
FormStr += "<textarea name='textarea' id='externalNotesMon' style='min-height:120px'></textarea>";
FormStr += "</div>";
FormStr += "<div data-role='fieldcontain'>";
FormStr += "<label for='internalNotesMon'>Intern Text</label>";
FormStr += "<textarea name='textarea' id='internalNotesMon' style='min-height:120px'></textarea>";
FormStr += "</div>";
projectListStr +=FormStr;
projectListStr += "</div>";
});
projectListStr += "</div>";
//projectListStr +="</ul>";
$('#ProjectList').html(projectListStr);
$('#home2').page();