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 second 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();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.