Prev Demo
jQuery
>
.Removeclass() - Remove Class From Element
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <style> .class1{ color:pink; } .class2{ color:blue; } .class3{ color:green; } .class4{ color:red; } </style> </head> <body> <p id="div1" class="class2">This is DIV1 with CLASS2</p> <p id="div2" class="class1">This is DIV2 with CLASS1</p> <p id="div3" class="class4">This is DIV3 with CLASS4</p> <p id="div4" class="class3">This is DIV4 with CLASS3</p> <br /> <br /> <p>Hence the class of DIV2 with CLASS1 is removed successfully.</p> <script> $("#div2").removeClass("class1"); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output