var show = $('#test').css('display');
$('#test').css('display',show =='block'?'none':show);

  这段代码通过判断当前元素的display的值来设置它的display值,如果是none就设成block,如果是block就设置成none,从而实现了隐藏和现实的切换。

相关文章:

  • 2022-12-23
  • 2021-05-13
  • 2021-08-23
  • 2021-09-30
猜你喜欢
  • 2021-06-05
  • 2022-12-23
  • 2022-02-16
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案