I am trying to hide an element on a details page, but I can't quite figure it out. I have a yes or no field in my table and if the field is yes I want to display the element, and if the field is no, I want to hide the element. I feel like I'm doing something wrong in either the way I'm setting the variable or the way I'm doing my if statement. It could also be that the field is not passing a yes or no, but something else like a 1 and 0. Could some one look at the code and help me out? FIRE_PLAN is the yes or no variable in my table. Right now it hides it no matter what the FIRE_PLAN field is set to. Just FYI, FIRE_PLAN is a display only field which means I can't just set a rule to hide the element.
I have this in an html box on my details page
<div id="firesection"><a href="[@field:FIRE_PLAN_URL]"><img alt="" src="http://censoredurl.com/fire.png" style="width: 90px; height: 90px;" /></a><br />
View fire plan for this address</div>
In the footer I have the following code
<script>
var fireplan = document.getElementById("FIRE_PLAN");
if(fireplan == "Yes")
{
document.getElementById('firesection').style.display = "block";
}
else
{
document.getElementById('firesection').style.display = "none";
}
</script>