开发者

trying to hide/show div with jquery by clicking one link

here's my js:

$(document).ready(function() {

    $('.LoginContainer').hide();

    $('.list li a').click(function(){
    $('.LoginContainer').toggle();
    });

});

This only makes the div with class="loginContainer" appear for a split se开发者_StackOverflow社区cond and then dissapear. I want for the div to appear when I click the link, and then dissapear when I click the link again.


Try this:

  $('.list li a').click(function(e){
     $('.LoginContainer').toggle();
     e.preventDefault();
  });


You can Try this

$(document).ready(function() {

     $('.className').click(function(e){
          $('.LoginContainer').toggle();
          e.preventDefault();
     });

}

I agree with e.preventDefault();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜