I have a page where a specific div shows the ID for the user's "system role" like so:
<div id="systemRoleIndicator" style="display: none;">
<p>Z</p>
</div>
I can detect the value fine with jQuery, but I can't seem to actually use it for anything. For instance, I never receive the completion message in this code:
<script src="/scripts/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
var role = $("#systemRoleIndicator").text();
alert("Your role is: " + role); //displays proper value
if (role == "Z") {
alert("Code completed!");
}
</script>
Why might this be? Am I missing something about comparing strings?