Skip to content

Instantly share code, notes, and snippets.

@ajtack
Created May 4, 2009 04:18
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 ajtack/106296 to your computer and use it in GitHub Desktop.
Save ajtack/106296 to your computer and use it in GitHub Desktop.
Using JQuery, takes any link in the login form of a particular class, automatically converts the text to an ID-able string (e.g. "Phone Number" -> "session_phone_number"), and then shows that div and hides all the others.
$(document).ready(function() {
$('#LoginForm a.login_method_switch').click(function() {
var blockToShow = '#session_' + this.text.toLowerCase().replace(' ', '_');
$('#LoginForm ' + blockToShow).show("slow");
$('#LoginForm .session_login_method:not(' + blockToShow + ')').hide("slow");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment