I'm trying to automatically check radio buttons basing on parameters' values in URL. These parameters were added into URL after user selected some values and submitted the form on the previous page. On the next page there is a form with the same and some other inputs. What I want to do, is to check the same values, that user have chosen on the previous page for the radios.
Lets say I have this URL for the page two: domain.com/page.html?checkbox-one=1&checkbox-two=0
In this page I have radio inputs:
<input type="radio" name="checkbox-one" value="0" id="radio1" />
<label for="radio1">Radio#1</label>
<input type="radio" name="checkbox-one" value="1" id="radio2" />
<label for="radio2">Radio#2</label>
<input type="radio" name="checkbox-two" value="0" id="radio3" />
<label for="radio3">Radio#3</label>
<input type="radio" name="checkbox-two" value="1" id="radio4" />
<label for="radio4">Radio#4</label>
In this case I want to see name="checkbox-one" value="1"
and name="checkbox-two" value="0"
checked.
PHP solution is not desirable, so how do I achieve this with jQuery. Is there way to read URL parameter values and check radio buttons basing on them?
Thank you!