Analyzing element js and whether to show or hide jQuery

jquery div determine whether to show or hide 



a lot of time will be to judge the show is not a div, did not show how to deal, how to handle the display; 

the method is very simple, you have to choose to judge the div, then IS ( ': hidden' ) determines whether to hide; with or is (: "visible" determines whether the display); 

determining if the code is displayed or not, such as: 

IF ($ ( '# div'). IS ( ': hidden' )) { 

      // if Hide Time. . . 

} The else { 

      // If the display. . . 

} 

Javarcript Method: 

var O = document.getElementById ( "DIV1" ) .style.display;          
   IF (O == "none")   // already hidden 
  { 
       document.getElementById ( "DIV1") the innerHTML = "";.     // content div to display 
       document.getElementById ( "div1"). style    .Made visible 
  } 

the else 
   { 
        document.getElementById ( "DIV1") the innerHTML = ".";    // div content to be displayed 
        document.getElementById ( "DIV1") none ". Style.display =.";     // make it invisible 
  }

 

Guess you like

Origin www.cnblogs.com/Samuel-Leung/p/11242867.html