Created
July 22, 2011 19:26
-
-
Save seancoyne/1100220 to your computer and use it in GitHub Desktop.
Example show Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $("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