Javascript to detect whether the dropdown of a select element is visible

后端 未结 7 999
甜味超标
甜味超标 2020-12-19 08:39

I have a select element in a form, and I want to display something only if the dropdown is not visible. Things I have tried:

  • Watching for click events, where
7条回答
  •  南方客
    南方客 (楼主)
    2020-12-19 09:01

    In jQuery, to test if something is visible:

    $('something').css('display')
    

    This will return something like 'block', 'inline', or 'none' (if element is not displayed). This is simply a representation of the CSS 'display' attribute.

提交回复
热议问题