Jquery - How to get the style display attribute “none / block”

后端 未结 5 619
深忆病人
深忆病人 2021-01-30 04:08

Is there a way to get the style: display attribute which would have either none or block?

DIV :

5条回答
  •  终归单人心
    2021-01-30 04:37

    If you're using jquery 1.6.2 you only need to code

    $('#theid').css('display')
    

    for example:

    if($('#theid').css('display') == 'none'){ 
       $('#theid').show('slow'); 
    } else { 
       $('#theid').hide('slow'); 
    }
    

提交回复
热议问题