Reputation: 20163
Hi I need to remove the class 'fancy' to all fancy items,
<script type="text/javascript">
$(document).ready(function(){
$('.fancy').removeClass('.fancy');
alert($('.fancy').length + 'comentarios');
});
</script>
Trying like that, the class is not removed and the alert shows me '6comentarios' so there are 6 items selected,
what am i missing??
thanks!
Upvotes: 0
Views: 65
Reputation: 10127
You are removing the class from an array of objects. That will probably not work. Try the each() function.
$('.fancy').each( function() { this.removeClass('fancy'); } );
Upvotes: -1
Reputation: 50976
$('.fancy').removeClass('fancy');
will work. Dot before className means "class", so in this case (removeClass) it's not allowed/required
Upvotes: 0
Reputation: 7117
You don't have to provide a selector as an argument, simply a class name.
Try:
$('.fancy').removeClass('fancy');
Upvotes: 5