I have a block(div) where i use to put information. I have a hidden form there? and it shows on click. But If I reload data in block(div) it works like link .
This is my script:
var comment_block ;
var show_comment_block;
var show;
$(function(){
$('A.reply').on('click',ShowCommentBlock);
});
function ShowCommentBlock(){
$(this).parent().next('.answer-form').slideToggle('slow');
return false;
}
And it is the code on my button:
<a class="reply" href="#comment<?php echo $comment['comment_id']?>">Ответить</a>
As i understand after content reload in block(div) i have to put this actions on new forms? I dont understand how to do that? or maybe there is some other kind of solution. Thanks.
You have to use delegation, eg:
$(document.body).on('click','A.reply', ShowCommentBlock);
A. Wolff
Thank U!
也许将其更改为:
$('A.reply').live("click", ShowCommentBlock);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.