Created
October 29, 2010 05:42
-
-
Save adam/652991 to your computer and use it in GitHub Desktop.
This file contains 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
$(document).ready(function() { | |
if (window.location.search.length > 0) { | |
// crunch the window.location.search to pull the query value | |
var parsedQuery = jQuery.map(window.location.search.replace('?', '').split("&"), function(val, i){return [val.split('=')[0], val.split('=')[1]]}); | |
var queryValue = parsedQuery[parsedQuery.indexOf('query') + 1].replace('+', ' '); | |
if (queryValue && queryValue != null && queryValue != '') { | |
$('.search form input[type=text]').val(queryValue); | |
$('.search form input[type=text]').attr('original_value', queryValue); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment