jquery 中的hide()与show() 和一些其他方法

1、点击谁让他显示,它的兄弟节点隐藏

$('.goods').show().siblings().hide()

2、点击它,让他里面说有的元素都显示

 $('#pingjia').children().show()

3、处了使用jquery的方法之外还可以动态的添加类名进行切换

$('.goods').addClass('xianshi').siblings().removeClass('xianshi');

4、对同一个元素进行点击,显示与隐藏时可以使用 toggle

$('button').on('click',function(){

$('p').toggle();

});

猜你喜欢

转载自www.cnblogs.com/Progress-/p/11424079.html