How to use HTML RemoveClass Method in JQuery
This article describe about HTML RemoveClass Method in JQuery.
HTML removeClass() method in jQuery
The removeClass() method is remove all selected elements in the classes.
removeClass() method is remove one or more classes.
Syntax
$(selector).removeClass(classname)
|
Example
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function ()
{
$("button").click(function ()
{
$("p").removeClass("intro");
});
});
</script>
<style type="text/css">
.intro
{
font-size:120%;
color:red;
}
</style>
</head>
<body>
<h1>This is a JQuery</h1>
<p class="intro">This is a .Netheaven.</p>
<p>This is HTML.</p>
<button>Remove the "intro" class from all p elements</button>
</body>
</html>
|
Output1
Output2
Using a Function
We use a function to remove a class from the selected elements.
Syntax
$(selector).removeClass(function(index,oldclass))
|
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here