Skip to content

Instantly share code, notes, and snippets.

@seancoyne
Created July 22, 2011 19:26
Show Gist options
  • Select an option

  • Save seancoyne/1100220 to your computer and use it in GitHub Desktop.

Select an option

Save seancoyne/1100220 to your computer and use it in GitHub Desktop.
Example show Javascript
$("a.tab").click(function(event){
event.preventDefault();
var id = $(this).attr('id'); // gets the ID of whatever you clicked on
var a = id.split("_"); // a is now an array with 2 items ("link" and the number)
var num = a[1]; // num is now the number of the "link_x" link that was clicked
var target = "info_" + num.toString(); // appends the number to an "info_" string
console.log(target);
$("#" + target).show(); // shows the block
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment