<!DOCTYPE html>
<html>
<head>
<title>
How to check an element is
visible or not using jQuery?
</title>
<script src=
</script>
</head>
<body style="text-align:center;">
<h1 style = "color:green;" >
GeeksForGeeks
</h1>
<h3>
How to check an element is
visible or not using jQuery ?
</h3>
<p style="display: none;">
GEEKSFORGEEKS - A computer science
portal for geeks.
</p>
<input onclick="change()" type="button"
value="Click to Display" id="myButton1">
</input>
<script type="text/javascript">
$(document).ready(function() {
$("input").click(function() {
// Display hide paragraph on button click
if (this.value == "Click to Display")
this.value = "Click to Hide";
else this.value = "Click to Display";
$("p").toggle("slow", function() {
// Check paragraph once toggle
// effect is completed
if($("p").is(":visible")) {
alert("Paragraph is visible.");
} else {
alert("Paragraph is hidden.");
}
});
});
});
</script>
</body>
</html>