Can someone assist me with checking the visibility of a div using JavaScript and ASP.Net?
I have written code below that is supposed to trigger an alert message when the div is not visible, but it does not seem to be working properly.
Any guidance on how to correct this issue would be greatly appreciated. The programming languages used are C# and JavaScript.
<script>
function checkDivVisibility() {
var divDateFiltersID = document.getElementById('<%=divDateFilters.ClientID%>');
if (divDateFiltersID.style.visibility == "hidden") {
alert("hi");
}
}
</script>
<!-- Button to call the function -->
<asp:Button ID="buttCustomerFilt" runat="server" class="btn btn-primary" ClientIDMode="Static" Text="Run Report" OnClientClick="if ( ! checkDivVisibility()) return false;" OnClick="buttCustomerFilt_Click" /></div>
<!-- Div to be checked for visibility -->
<div runat="server" id="divDateFilters" visible="false"></div>