jQuery check element visible Hidden


jQuery check element visible Hidden – Basically Visibility of any element is controlled by css styles. You can also control the visibility of elements using JavaScript or jQuey. Here in this tutorial we are going to explain how you can check that element is visible or not. You can try this with our online editor which will run the example in real time.


jQuery check element visible Hidden Example : Check Visibility

It is very simple to check the visibility of an element. You can check that element is visible or hidden using the jQuery Below-

Check Element is Visible

Here is an example to check the visibility of element as below –

jQuery check element visible Hidden : Check Visibility Example

<script type="text/javascript">
function checkVisibility(){
var isVisible = $('#myDiv').is(':visible');
if(isVisible){
alert("Div Is Visible.");
}              
</script>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

Try it »

If you run the above example it will produce output something like this –

jQuery check element visibile Hidden

Check Element is Hidden

Here is an example to check if the element is hidden as below –

jQuery check element visible Hidden : Check Hidden Example

<script type="text/javascript">
function checkVisibility(){
var ishidden= $('#myDiv').is(':hidden');
if(ishidden){
alert("Div Is Hidden.");
}              
</script>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

Try it »

If you run the above example it will produce output something like this –

jQuery check element visible Hidden


Advertisements

Add Comment