Is there a proper way to display a hidden div only when certain conditions are met? For example, I want to show a login error message within a div only if there is an error.
<div id= "error" class="alert alert-danger" hidden="hidden" role="alert">
${loginError}
</div>
I attempted to use a script to achieve this but it was unsuccessful.
<script type="text/javascript">
if(null != request.getAttribute("loginError")){
document.getElementById("error").removeAttribute("hidden");
}
</script>