Hbaecklund Hbaecklund - 3 months ago 12
jQuery Question

How to remove class with jquery?

How do I remove the hidden class? In order to show the ribbon?

Html

<div id="alwaysInStockRibbon" class="ribbon-wrapper-productpage hidden">


Css

.hidden {
display: none!important;
visibility: hidden!important;


I've tried these below without success.

Jquery

$(".hidden").remove();
$(".hidden").removeClass();


https://api.jquery.com/remove/

https://api.jquery.com/removeClass/

Input?

Answer

You need to pass classname as argument in removeClass method to remove it in matched set:

Remove a single class, multiple classes, or all classes from each element in the set of matched elements.

 $(".hidden").removeClass('hidden');