+ 1

How can i append value to an exist attribute value using JQuery ?

is there any method except this: before: <p class="demo">hello</p> $("p").attr("class", $("p").attr("class") + " active"); after: <p class="demo active">hello</p>

19th Apr 2021, 2:01 PM
Imrane Aabbou
Imrane Aabbou - avatar
2 Réponses
+ 1
Maybe this? $("p").addClass("active");
19th Apr 2021, 2:34 PM
Russ
Russ - avatar
0
Russ thank uuuu
21st Apr 2021, 4:26 AM
Imrane Aabbou
Imrane Aabbou - avatar