Check div is hidden using jquery

前端 未结 6 1086
故里飘歌
故里飘歌 2021-02-01 14:46

This is my div

Then I have a Show button that will show the div when you click:

6条回答
  •  梦谈多话
    2021-02-01 15:22

    You can check the CSS display property:

    if ($('#car').css('display') == 'none') {
        alert('Car 2 is hidden');
    }
    

    Here is a demo: http://jsfiddle.net/YjP4K/

提交回复
热议问题