All TalkersCode Topics

Follow TalkersCode On Social Media

jQuery Remove Class

Last Updated : Jan 1, 2023

jQuery Remove Class

In this article we will show you the solution of jQuery remove class, here we are going to show you example for remove class from element with the help of removeClass() method.

The removeClass() method removes one or more class names from the selected elements.

So we can easily remove one class from paragraph <p> tag element in html.

Step By Step Guide On jQuery Remove Class :-

Here we defined heading tag, two paragraph tags with some contents and at last button ‘Remove Class’.

In script block we defined ready() method which is automatically starts loading code of within this function when this program opened on browser and within that defined click() method with element name ‘button’ so which is refers when clicks on button click() event will load particular process.

There we defined removeClass() method with ‘intro’ class name which is contain two properties of style we are removing that style from element p in html code which is has intro class.

<!DOCTYPE html>
        <title>REMOVE ELEMENT USING JQUERY</title>
        <script src=""></script>
                font-size: 120%;
                color: blue;
        <h1>Welcome All</h1>
        <p class="intro">This is first paragraph tag</p>
        <p>This is second paragraph tag</p>
        <button>Remove Class</button>
  1. <!DOCTYPE html> tag which is instruct the web browser about what version of HTML file written in and it’s not have any ending tag.
  2. The<html> tag is used to indicate the beginning of HTML document.
  3. As above shown <head> tag is contain information about webpage and external file links are declared here. <title> tag is used for set the webpage title.
  4. Here we imported open source jquery library support file which is needed for coding using jquery in program.
  5. Both <head> and <title> tags having their pair end tag, so we need to close the ending tags respectively. If you’re not closed anyone of ending tag properly that is also affect the webpage result.
  6. <body> tag is beginning of main coding part because it contain coding of entire website blocks and elements described here.
  7. In script we defined ready() and click() method within that we are goings to removing class ‘intro’ from p para element in html code by using ‘removeClass()’ method.
  8. So which process will begin when user clicks on button after loading this program on browser and in style block we defined two properties ‘font-size as 120%, font color as blue’ for class ‘intro’.
  9. In html block we defined h1 tag with text ‘Welcome All’ and two para tags with respective contents ‘This is first paragraph tag, This is second paragraph tag’, here first para element have intro class and lastly button ‘Remove Class’.
  10. Both </body>,</html> tags closed respectively. </body> tag indicates the end of body, Then </html> tag indicates the end of HTML document.

Conclusion :-

In conclusion now we are able to know how to remove class from any element in jquery.

Before execution of program we needs to confirm internet connection because then only that jquery file will supports defined jquery codes without error.

When we executes program on browser we can see heading, two lines of text first line text has some style so its look in blue color with big font size and a button, user needs to clicks on button then second tag text changed to become normal text without styles because we removed class style ‘intro’ from p element.

I hope this article on jQuery remove class helps you and the steps and method mentioned above are easy to follow and implement.

Latest Tutorials