How do you add and remove 'hidden'
from <p hidden>My Text</p>
?
I tried removing the attribute and setting it to false but neither of them worked.
let p = document.getElementsByTagName('p');
let myText;
for (i = 0; i < p.length; i++) {
if (p[i].innerHTML == "My Text") {
myText = p[i];
break;
}
}
myText.removeAttribute("hidden"); // no effect
myText.setAttribute("hidden", false); // no effect
hidden
is a css property of a dom object.w3schools.com/jsref/prop_style_visibility.asp w3schools.com/cssref/pr_class_visibility.asp – Relaxationp
element looks like? – Tiredp
element looks like this:<p hidden>My Text<\p>
– Sporran