Wie können Sie die Klasse red
zur Klasse question_body
hinzufügen, wenn die Frage entfernt wird?Aktion zu einem Lösch-Ereignis in jQuery hinzufügen
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");
})
});
Die von PHP erzeugt folgende URL sollte die Aktion,
aktivierenecho ("<a href='#'"
. "class='dulete_question'"
. " rel='" . $answer_id . "'>flag</a>"
);
Das Problem ist ähnlich as this one. Es schlägt mir vor, dass addClass
-Befehl sollte korrekt sein und dass das Problem in der Verwendung von es innerhalb der Funktion ist. diese
** Vielen Dank für Ihre Antwort! ** –