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