當我被先例問題的建議,下面就那並不是將不起作用代碼:click事件未檢測
<div class="comments"></div>
<textarea cols="" rows="" name="proposition" id="propo-textarea-spec"></textarea>
<button id="my-btn">Make m'y request!</button>
<div class="my-btn-spec invisible">
<div class="section">
<div class="info tag-comment-spec"></div>
<p class="targetting"></p>
</div>
</div>
<script>
$('#my-btn').click(function() {
var comment = $('#propo-textarea-spec').val();
$('.targetting:last').text(comment);
var content = $('div.my-btn-spec').html();
$('div .comments').append(content);
});
$('.comments .tag-comment-spec').click(function(){
alert('hello');
});
</script>
事實是,代碼工作細,附加股利,但它是單擊新的附加div時不可能觸發警報消息。奇怪的是,我的檢查員正確檢測到tag-comment-spec div,但點擊什麼都沒有觸發。
有沒有人有想法?
它的工作原理很好。謝謝 !!最佳 –
@MehdiBenchoufi不客氣。不要錯過接受 – thecodeparadox