Grab URL parameters to maintain search form options using jQuery or javascript
<p>I have a set of search filters that set a URL string (for further processing). As the page reloads to show the results, the options selected by the user are lost. I was wondering if it's possible to use jquery to capture the parameters from the url and 'remember' what options had been selected?</p>

<p>For example, if my URL contained
www.something.com/index.html?&amp;colour=red&amp;circle=1&amp;star=0, my form would load with the following:</p>

<pre><code>&lt;h3&gt;Colour&lt;/h3&gt;
&lt;p&gt;Blue: &lt;input name="colour" type="radio" value="blue" /&gt;&lt;/p&gt;
&lt;p&gt;Red: &lt;input name="colour" type="radio" value="red" /&gt;&lt;/p&gt; [selected]
&lt;p&gt;Green: &lt;input name="colour" type="radio" value="green" /&gt;&lt;/p&gt;

&lt;h3&gt;Shape&lt;/h3&gt;
&lt;p&gt;Circle: &lt;input name="circle" type="checkbox" value="1" /&gt;&lt;/p&gt; [selected]
&lt;p&gt;Square: &lt;input name="square" type="checkbox" value="1" /&gt;&lt;/p&gt;
&lt;p&gt;Star: &lt;input name="star" type="checkbox" value="1" /&gt;&lt;/p&gt;
</code></pre>

<p>Thanks for looking.</p>
