jQueryでどのように属性id
を削除できますか?jQueryのために `removeClass`のように 'removeClasses'を持たせるには
jQuery('a.no_flag_question').live('click', function(){
jQuery.post('/codes/handlers/no_flag_question.php',
{ question_id: jQuery(this).attr('rel') });
$(".question_box").removeClass("yellow"); // problem here
alert ("Question is now not spam.");
});
このコードは、しかし、これは動作しません
<div id="yellow" class="question_box">
に、次の黄色-attributeを削除する必要があります。理由はおそらく関数removeClass
です。 IDを使いたいので間違った機能を使っているようです。 class
は、複数の値を持つ属性があるので...あなたは<div class="one two three">
を持っていて、それに.removeClass("two")
を呼び出す場合http://docs.jquery.com/Attributes/removeAttr
は、あなたの答えをありがとう! –
なぜ識別子を削除していますか?あなたは奇妙なビジネスロジックをしているようです。 – epascarello