diff --git a/entries/removeClass.xml b/entries/removeClass.xml
index c2daa31c..2edb382d 100644
--- a/entries/removeClass.xml
+++ b/entries/removeClass.xml
@@ -1,177 +1,196 @@
- If a class name is included as a parameter, then only that class will be removed from the set of matched elements. If no classes are specified in the parameter, all classes will be removed. Before jQuery version 1.12/2.2, the As of jQuery 1.12/2.2, this behavior is changed to improve the support for XML documents, including SVG. Starting from this version, the More than one class may be removed at a time, separated by a space, from the set of matched elements, like so: This method is often used with Here, the To replace all existing classes with another class, we can use As of jQuery 1.4, the This example removes the class name of the penultimate .removeClass()
method manipulated the className
property of the selected elements, not the class
attribute. Once the property was changed, it was the browser that updated the attribute accordingly. This means that when the class
attribute was updated and the last class name was removed, the browser might have set the attribute's value to an empty string instead of removing the attribute completely. An implication of this behavior was that this method only worked for documents with HTML DOM semantics (e.g., not pure XML documents).class
attribute is used instead. So, .removeClass()
can be used on XML or SVG documents.
-
-$( "p" ).removeClass( "myClass yourClass" )
-
.addClass()
to switch elements' classes from one to another, like so:
-
-$( "p" ).removeClass( "myClass noClass" ).addClass( "yourClass" );
-
myClass
and noClass
classes are removed from all paragraphs, while yourClass
is added..attr( "class", "newClass" )
instead..removeClass()
method allows us to indicate the class to be removed by passing in a function.
-
-$( "li" ).last().removeClass(function() {
- return $( this ).prev().attr( "class" );
-});
-
<li>
from the last <li>
.
-
and
-then
-Goodbye
-]]> - -
- and
-then
-Goodbye
-]]> -
- and
-then
-Goodbye
-]]> -
- and
-then
-Goodbye
-]]> -Before jQuery version 1.12/2.2, the .removeClass()
method manipulated the className
property of the selected elements, not the class
attribute. Once the property was changed, it was the browser that updated the attribute accordingly. This means that when the class
attribute was updated and the last class name was removed, the browser might have set the attribute's value to an empty string instead of removing the attribute completely. An implication of this behavior was that this method only worked for documents with HTML DOM semantics (e.g., not pure XML documents).
As of jQuery 1.12/2.2, this behavior is changed to improve the support for XML documents, including SVG. Starting from this version, the class
attribute is used instead. So, .removeClass()
can be used on XML or SVG documents.
More than one class may be removed at a time, separated by a space, from the set of matched elements, like so:
+
+ $( "p" ).removeClass( "myClass yourClass" )
+
+ This method is often used with .addClass()
to switch elements' classes from one to another, like so:
+ $( "p" ).removeClass( "myClass noClass" ).addClass( "yourClass" );
+
+ Here, the myClass
and noClass
classes are removed from all paragraphs, while yourClass
is added.
To replace all existing classes with another class, we can use .attr( "class", "newClass" )
instead.
As of jQuery 1.4, the .removeClass()
method allows us to indicate the class to be removed by passing in a function.
+ $( "li" ).last().removeClass(function() {
+ return $( this ).prev().attr( "class" );
+ });
+
+ This example removes the class name of the penultimate <li>
from the last <li>
.
+ and
+then
+Goodbye
+ ]]> +
+ and
+then
+Goodbye
+ ]]> +
+ and
+then
+Goodbye
+ ]]> +Before jQuery version 1.12/2.2, the .removeClass()
method manipulated the className
property of the selected elements, not the class
attribute. Once the property was changed, it was the browser that updated the attribute accordingly. This means that when the class
attribute was updated and the last class name was removed, the browser might have set the attribute's value to an empty string instead of removing the attribute completely. An implication of this behavior was that this method only worked for documents with HTML DOM semantics (e.g., not pure XML documents).
As of jQuery 1.12/2.2, this behavior is changed to improve the support for XML documents, including SVG. Starting from this version, the class
attribute is used instead. So, .removeClass()
can be used on XML or SVG documents.
+ and
+then
+Goodbye
+ ]]> +