Javascript 以错误的方式使用引导动态添加面板

Javascript 以错误的方式使用引导动态添加面板,javascript,jquery,ajax,twitter-bootstrap,twitter-bootstrap-3,Javascript,Jquery,Ajax,Twitter Bootstrap,Twitter Bootstrap 3,我使用了带引导的折叠面板,它在静态方式下运行良好,但当我尝试动态添加它时,它不起作用 HTML 评论: 主题、模板和其他项目的所有价格,包括每个卖家或买家的账户余额,均以美元为单位 JavaScript $(“#AddQuestId”)。单击(函数(){ $(“#手风琴”)。附加(“”)+ ''+ ' '+ ' '+ ''+ ''+ ''+ '在预引导中注册帐户'+ ''+ ''+ ''+ ''+ ''); }); 不需要用javascript编写整个折叠面板代码。只需使用HTMLDOM来

我使用了带引导的折叠面板,它在静态方式下运行良好,但当我尝试动态添加它时,它不起作用

HTML

评论:
主题、模板和其他项目的所有价格,包括每个卖家或买家的账户余额,均以美元为单位
JavaScript
$(“#AddQuestId”)。单击(函数(){
$(“#手风琴”)。附加(“”)+
''+
' '+
'  '+
''+
''+
''+
'在预引导中注册帐户'+
''+
''+
''+
''+
'');
});

不需要用javascript编写整个折叠面板代码。只需使用HTMLDOM来注入动态内容。例如,如果要在面板主体中填充某些动态内容:

<div class="panel-body">
  <p id = "description"> All prices for themes, templates and other items, including each seller's or buyer's account balance are in <strong>USD</strong> </p>
</div>

在第三行中,我将面板标题的ID设为“ID”

你的锚的href与你的.panel折叠的ID不匹配。将href更改为#collapse14,您的代码就可以工作了。尝试添加另一个它不起作用correctly@SeanWessell我更新了问题,请再次查看,因为我是哑巴!,我不知道解决办法在哪里
$( "#AddQuestId" ).click(function() {
    $("#accordion").append('<div class="panel panel-default">'+
    '<div class="panel-heading">'+
    '<h4 class="panel-title"> '+
    '<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse14">'+$("#comment").val()+'</a>  </h4>'+
    '</div>'+
    '<div id="collapse14" class="panel-collapse collapse in">'+
    '<div class="panel-body">'+
    'Account registration at <strong>PrepBootstrap</strong>'+
    '</div>'+
    '</div>'+
     '</div>'+
    '</h4>'+
     '</div>');
});
<div class="panel-body">
  <p id = "description"> All prices for themes, templates and other items, including each seller's or buyer's account balance are in <strong>USD</strong> </p>
</div>
$( "#AddQuestId" ).click(function() {
document.getElementById("description").innerHTML = "Account registration at PrepBootstrap";
document.getElementById("id").innerHTML = comment;
    });