Javascript 我想在每次单击时隐藏并显示一个div
我想在每次单击时隐藏和显示一个div,但它只显示和隐藏一次,但在单击按钮时再也不会显示Javascript 我想在每次单击时隐藏并显示一个div,javascript,jquery,Javascript,Jquery,我想在每次单击时隐藏和显示一个div,但它只显示和隐藏一次,但在单击按钮时再也不会显示 $(文档).ready(函数(){ $(“.disp comment”).hide(); $(“.comnt区域视图”)。单击(函数(){ 警惕(“你好”); $(this.next(“.disp comment”).show() }); }); 添加注释 添加注释 $(函数(){ $(“.disp comment”).hide(); $(“.comnt区域视图”)。单击(函数(){ 警惕(“你好”);
$(文档).ready(函数(){
$(“.disp comment”).hide();
$(“.comnt区域视图”)。单击(函数(){
警惕(“你好”);
$(this.next(“.disp comment”).show()
});
});代码>
添加注释
添加注释
$(函数(){
$(“.disp comment”).hide();
$(“.comnt区域视图”)。单击(函数(){
警惕(“你好”);
$(this).next(“.disp comment”).toggle('hide,show');
});
})
添加注释
添加注释
我对您的代码做了一些修改。让我知道这是否有用。谢谢
这是普朗克
使用.toggle
而不是。显示可能重复的
$(document).ready(function() {
$(".disp-comment").hide();
console.log($(".disp-comment"))
$(".comnt-area-view").click(function() {
if ($(this).next()[0].style.display == 'none')
$(this).next().show()
else
$(this).next().hide()
});
});