I'm trying to dynamically hide content from users who are not at least on a certain level.
All users can see level 1 content, but they will need to reach a higher level in order to see more content.
The level will be generated inside an html tag (id="level") through the use of a Wordpress plugin shortcode. The content for level 2 or higher will be hidden by default in the html div tag (id="myDiv").
I'm trying to change the style display property from myDiv through a javascript function.
function myFunction()
{
var myDiv = document.GetElementById("myDiv");
var level = document.GetElementById("level").innerHTML;
if (level >= 2) {
myDiv.style.display = "block";
} else {
myDiv.style.display = "none";
}
}
<body onLoad="myFunction();">
<div id="level">2</div>
<div id="myDiv" style="display:none;">myDiv content</div>
</body>