Is it possible to change the display attribute to block !important
on a specific element when a certain string is present in the URL?
I have searched for a solution, but so far I haven't found one. The code snippet below allows me to set the body's background color to green !important
, but I am unsure how to target a different element (in this case, the element with the id of "loginActive").
:javascript
if(window.location.href.indexOf("sign_up") > -1) {
document.body.style.setProperty ("background-color", "green", "important");
document.getElementById("loginActive").style.display = "block", "important";
}
Any suggestions on how I can apply display: block !important
to the #loginActive
element?