Loading ...

Remove all the classes from a selector in jquery

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  client side web development   » Remove all the classes from a selector in jquery

Remove all the classes from a selector in jquery

Posts under the topic: Remove all the classes from a selector in jquery

Posted: 5/21/2010

Lurker 235  points  Lurker
  • Joined on: 10/16/2009
  • Posts: 47

Hi friends ,

 

I know how to use selector.removeClass('className') to remove a particular class from a selector, but I want to remove all the classes and I am unable to find anything like

.removeAllClass  in jquery. How can remove all the classes ?


Posted: 5/22/2010

Lurker 270  points  Lurker
  • Joined on: 1/3/2009
  • Posts: 14

kevin said:

Hi friends ,

 

I know how to use selector.removeClass('className') to remove a particular class from a selector, but I want to remove all the classes and I am unable to find anything like

.removeAllClass  in jquery. How can remove all the classes ?

 

Hi kevin,

you can use below code to remove all css from the page.

<script type="text/javascript">
        $(function() {
            $("#removeAllCss").click(function() {
                $('link[rel=stylesheet]').remove();
            });
        });
</script>


 

 

hope this will help you.


Posted: 5/22/2010

Guru 16518  points  Guru
  • Joined on: 4/19/2009
  • Posts: 483
  Answered

You already have the solution in your question just remove the class name selector.removeClass()

 

 


Page 1 of 1 (3 items)