+ 4
Why isnt the code working?
The border in css is staying the same color when in changing it with toggleClass() and so is the text. How do i change it? https://code.sololearn.com/W0n0C6zoCsdE/?ref=app
8 Respuestas
+ 2
Gavin
I made a mistake when I posted the code Gavin Test previously. The code below has the correction to toggleClass and I also removed !important from CSS as it in not needed.
https://code.sololearn.com/WCXYvm3pItl8/?ref=app
+ 5
Add the !important to the border of .new
border:5px solid blue !important;
+ 4
Senior pasan how does that work I haven't learned that but I finished css?
+ 4
Trying to change the border with toggling class will not work as it won't override the border property. But using !important will force to override any css rule defined for an element.
Yes there is no lesson about !important in Sololearn.
You have to refer for another resource
https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity#The_!important_exception
+ 4
Ok thanks for helping me with this
+ 3
Seniru
+ 3
Ok thanks
+ 1
Seniru Pasan, Gavin McPherson
$("p").toggleClass("new", "old") should be $("p").toggleClass("new old")
source - http://api.jquery.com/toggleclass/#toggleClass-className-state
https://code.sololearn.com/WA4w64I9pwbD/#html