How can you remove the attribute id by jQuery?
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.");
});
This code should remove the following yellow -attribute in
<div id="yellow" class="question_box">
However, this does not work. The reason is very likely the function removeClass.
I apparently use wrong function, since I want to use the ID.
$('.question_box').removeAttr('id')
More info at http://docs.jquery.com/Attributes/removeAttr
removeClass only exists because class is a multi-valued attribute... if you have a <div class="one two three"> and you call .removeClass("two") on it, it should end up with class="one three". addClass and removeClass exist to save you from doing all that work yourself. id isn't special in that way, so you just access it with attr.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With