Skip to content

Instantly share code, notes, and snippets.

@rsgranne
Created July 5, 2018 23:04
Show Gist options
  • Select an option

  • Save rsgranne/66361cc72aa679665fdbc19756c7edf0 to your computer and use it in GitHub Desktop.

Select an option

Save rsgranne/66361cc72aa679665fdbc19756c7edf0 to your computer and use it in GitHub Desktop.
Used with oasis-star-wars-bootstrap
$(document).ready(
function() {
var switcherFunc = function() {
$('> .btn', this.parentNode).addClass('btn-default').removeClass('btn-primary');
$(this).addClass('btn-primary');
};
$('.sex .btn').on('click', switcherFunc);
$('.race .btn').on('click', switcherFunc);
$('.stats .btn').on('click', switcherFunc);
var characterSwitcherFunc = function() {
$('.btn', this.closest('.characters')).addClass('btn-default').removeClass('btn-primary');
$(this).addClass('btn-primary');
};
$('.characters .btn').on('click', characterSwitcherFunc);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment