How can you add the class red to the class question_body when the question is removed?
JS in 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");
})
});
The following URL generated by PHP should activate the action,
echo ("<a href='#'"
. "class='dulete_question'"
. " rel='" . $answer_id . "'>flag</a>"
);
The problem is similar as this one. It suggests me that addClass -command should be correct and that the problem is in the use of it inside the function.
Change this:
To this:
Also make sure you have a CSS class called “red” defined.
You can test this by moving the alert to before the addClass line, rather than after it.