Skip to content

Instantly share code, notes, and snippets.

@PhilETaylor
Last active August 23, 2017 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PhilETaylor/735138b8800b89015ff966b5ea6ca544 to your computer and use it in GitHub Desktop.
Save PhilETaylor/735138b8800b89015ff966b5ea6ca544 to your computer and use it in GitHub Desktop.
Make a tab active if a html5 validation is hidden
$(function(){
$('.tab-pane input, .tab-pane textarea').on('invalid', function(){
// Find the link that corresponds to the pane and have it show
$('.nav a[href="#' + $(this).closest('.tab-pane').attr('id') + '"]').tab('show');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment