1
如何在删除问题时将类red
添加到类question_body
?将操作添加到jQuery中的删除事件中
JS在HEAD,
jQuery('a.delete_question').live('click', function(){
jQuery.post('/codes/handlers/delete_a_question.php',
{ question_id: jQuery(this).attr('rel') },
function(){
$(.question_body).addClass("red"); // problem here
alert ("Question was removed");
})
});
以下URL由PHP生成应该激活动作,
echo ("<a href='#'"
. "class='dulete_question'"
. " rel='" . $answer_id . "'>flag</a>"
);
问题是类似as this one。它暗示我addClass
-命令应该是正确的,并且问题在于在函数内部使用它。
**非常感谢您的回答!** – 2009-08-22 18:27:17