Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove previous class and add new class in jquery?

I am storing my primary key as Classname

everytime this function called i will have new primary key key,

 function OnBtnShowPopupClick(elementID) {
                ASPxClientPopupControl1.ShowAtElementByID(elementID);
                $("#hiddenTag").addClass(elementID);
            }

what i want is to remove previous classname and add new className

how?

like image 614
Arti Patel Avatar asked Jan 16 '23 04:01

Arti Patel


1 Answers

Have you looked at removeClass

i.e

$("#hiddenTag").removeClass('someclass').addClass(elementID);

And if you don't know the class name:

$("#hiddenTag").removeAttr('class').addClass(elementID);
like image 138
webnoob Avatar answered Jan 23 '23 04:01

webnoob