Skip to content

Instantly share code, notes, and snippets.

@treasonx
Created April 30, 2013 14:42
Show Gist options
  • Save treasonx/5489172 to your computer and use it in GitHub Desktop.
Save treasonx/5489172 to your computer and use it in GitHub Desktop.
//Gets a jquery object containing all of the elements on the page that have a css class of "show-example1"
var showDescriptionInput = $('.show-example1');
//when someone clicks on an element with the id of "name" or "phone" run this function. I think "click.toggle"
//is a mistake it should be just click
$("#name, #phone").bind('click.toggle', function(e) {
//dont do the default HTML thing. SO if this is a link dont make the browser load the new page.
e.preventDefault();
//if the thing we clicked on has an id of "name"
if ($(this).prop('id') == 'name') {
//show this thing or things :)
showExample2.show(400);
} else {
//just hide
showExample2.hide();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment