Skip to content

Instantly share code, notes, and snippets.

@LayneSmith
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save LayneSmith/ec916d1fc2f8a4ed9fb9 to your computer and use it in GitHub Desktop.

Select an option

Save LayneSmith/ec916d1fc2f8a4ed9fb9 to your computer and use it in GitHub Desktop.
//url formate should be ...index.html/?targetDiv
$(document).ready(function () {
//CHECK FOR VARIABLES IN URL
var rawKeys = $(location).attr('search');
if (rawKeys) {
console.log(rawKeys); //displays "?targetDiv"
var strippedKey = rawKeys.substring(1); //get rid of question mark
console.log(strippedKey); //displays "targetDiv"
doStuff(strippedKey); //function call
}
});
//load this up with page manipulation
function doStuff(targetDiv) {
$("#" + targetDiv).show(); //should show target div
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment