[英]JQuery accordion not working with Javascript created content
我正在尋找一種使用表單將項目添加到Javascript數組中,然后使用其值來顯示手風琴的方法。
但是,當我創建一個值字符串並將其添加到HTML文件時,手風琴不起作用。 添加時的格式與手動輸入時的格式完全相同。
當我手動輸入相同的代碼時,手風琴工作正常
有任何想法嗎?
謝謝
創建字符串的代碼:
contact.prototype.contactList= function(){
var cl = "<h3>" + this.firstname + "</h3><div><p>" +
this.middlename + "" + this.lastname + "" + this.homeadd1 + ""+ this.homeadd2 + ""+ this.homeadd3 + ""+ this.homepost + ""+ this.workadd1 + ""+ this.workadd2 + ""+ this.workadd3 + ""+ this.workpost + ""+ this.email + ""+ this.homephone + ""+ this.workphone +""+ this.mobilephone +""+ this.dob +""+ this.relstat +"</p></div>";
return cl;
};
JS手風琴功能:
$('#accordion').on('update', 'h3', function() {
$( "#accordion" ).accordion();
});
我要添加內容的ID稱為手風琴
在此先感謝您的幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.