How to make class to be added on a particular page?

How to make class to be added on a particular page (the url which I want)?
June 26th 19 at 13:58
1 answer
June 26th 19 at 14:00
As an option to use a window.location.href. Check it out, if matches need to add the appropriate class to the element.
And you can give an example - karen.Murazik commented on June 26th 19 at 14:03
You can visit Klas on the body and check the script if there is any. And then the rest of the mess - reba_Kautz commented on June 26th 19 at 14:06
Adds a body class at boot: https://codepen.io/kerf/pen/mmxYvy - Edgar.Lesch commented on June 26th 19 at 14:09
: What is the reference letter s? s.codepen.io - karen.Murazik commented on June 26th 19 at 14:12
: This is just an example, to satisfy this condition, in your case will be your way. - Edgar.Lesch commented on June 26th 19 at 14:15
In WordPress, not a Fig does not work( - karen.Murazik commented on June 26th 19 at 14:18
:
window.onload = function() {
 if(window.location.host == "http://url") {
document.body.classList.add('add-to-body')
}
};
- karen.Murazik commented on June 26th 19 at 14:21
You make a console.log(window.location) for the pages you like and see what you want to insert in the condition that it was performed. - Edgar.Lesch commented on June 26th 19 at 14:24

Find more questions by tags JavaScriptjQuery