Javascript Ajax jQuery Html PHP Example Quiz New MORE

How to check an element is hidden in jQuery

<!Doctype html>
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <body>
        <script>
            $(document).ready(function() {
                var visible = $('#tElement').is(':visible');
                if (visible) {
                    alert("visible");
                } else {
                    alert("hidden");
                }
            });
        </script>
        Firstname:<input type="text" id="tElement" style="display:block;">
    </body>
</html>

Run it yourself


Download Source Code