我有这个 jQuery,它显然不起作用:
$('input.descriptionLC').click(function(){
$('.collapse').collapse('hide')
});
我的 html 是由这个 for 循环/附加生成的:
for (i=0; i < nodeArr.length; i++){
$('#accordion2').append('<div class="accordion-group">' +
'<div class="accordion-heading">' +
'<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse' + i + '">' +
'<hr class="inLC">' +
'<div class="divLC">' +
'<p class="titleLC">' + nodeArr[i][0] + '</p>' +
'<p class="imgWrap"><img class="imgLC" src="img/On_slider.png"></p>' +
'<input type="text" class="descriptionLC" id="description' + i + '">' +
'</div>' +
'</a>' +
'</div>' +
'<div id="collapse' + i + '" class="accordion-body collapse">' +
'<div class="accordion-inner">' +
'Anim pariatur cliche...' +
'</div>' +
'</div>' +
'</div>'
);
}