Revision: 12820
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 30, 2009 06:50 by kouphax
Initial Code
(function($) { /* --------------------------------------------------------------------- */ /* * Extracts a string parameter from the url query string. Basic operation * wont handle multiples such as radio buttons etc. Just gets the first * instance of the name and returns it's value. * * @param {String} Name of value to extract from URL QueryString. * @returns {String} Value of QueryString attribute or null if not found */ $.param = function(name) { var exp = new RegExp('[\\?&]' + name + '=([^&#]*)'); var param = exp.exec(window.location.href); return (param) ? param[1] : null; } })(jQuery); /* EXAMPLE USAGE */ /* Looks for a PageConfig object first then the Section querystring param */ $(function() { $('#tabs li a>span:contains(' + (($.PageConfig || {}).section || $.param("Section")) || "Home" + ')').parent().addClass("current"); });
Initial URL
Initial Description
Extracts a string paremeter from the url query string. Basic operation wont handle multiples such as radio buttons etc. Just gets the first instance of the name and returns it's value.
Initial Title
Primitive QueryString Param Extractor Plugin
Initial Tags
javascript, plugin, jquery
Initial Language
JavaScript