I want to set a button visibility based on what I retrieve from a session attribute in window.onload.. The alert appears so the button should become invisible.. Please let me know why it is still visible.
<button type="button" id="ex" onclick="">Ex</button>
<script>
window.onload = function(){
<%
Object ex = session.getAttribute("ex");
if (ex == null)
{
%>
alert("NULL");
document.getElementById('ex').style.visibility = 'hidden';
<%
}
else
{
%>
alert("NOT NULL");
<%
}
%>
};
</script>