Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

这段Jquery 三个按钮相互关系,如何给他简化,再多加按钮也不用动源码 #7

Open
Xia-lj opened this issue Sep 21, 2015 · 0 comments

Comments

@Xia-lj
Copy link

Xia-lj commented Sep 21, 2015

$( "#bt1" ).on( "click", function() {
$(this).addClass("active");
$( "#bt2" ).removeClass( "active" );
$( "#bt3" ).removeClass( "active" );
});
$( "#bt2" ).on( "click", function() {
$(this).addClass("active");
$( "#bt1" ).removeClass( "active" );
$( "#bt3" ).removeClass( "active" );
});
$( "#bt3" ).on( "click", function() {
$(this).addClass("active");
$( "#bt2" ).removeClass( "active" );
$( "#bt1" ).removeClass( "active" );
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant