Switch to full style
JQuery Examples
Post a reply

checking if a HTML element is visible or hidden under JQuery

Mon Jan 07, 2013 7:37 pm

For checking if a HTML element is visible or hidden under JQuery , for CSS display property :

css code
<style type="text/css">
div.nonVisib{
display:none;
}
</style>
<div class="nonVisib"> Your content Here </div>

To check if this element is hidden or visible :

javascript code
if( $('div.nonVisib').is(':visible') ) {
// in case the element is visible
}
else {
// in case the element is hidden
}

You can swap the conditions as this
javascript code
if( $('div.nonVisib').is(':hidden') ) {
// in case the element is hidden
}
else {
// in case the element is visible
}




Post a reply
  Related Posts  to : checking if a HTML element is visible or hidden under JQuery
 How to make html element hidden using CSS     -  
 Get the position of HTML element using JQuery     -  
 Show hint when focus on html element using JQuery     -  
 opacity of HTML element- transparent     -  
 Change and get html content of element     -  
 Get Width and Height -Inner and Outer for HTML element     -  
 Remove HTML element or Delete its content     -  
 removing focus border from a HTML element     -  
 Sort HTML table from JQuery     -  
 add pagination to html page using JQuery     -  

Topic Tags

JQuery Validation