How do I use only the selected radio button to show up in the URL? What I have always uses the first radio button regardless of which one is selected:
<form id="urlForm">
<div id="bounds">
<label><input type="radio" name="toggle" id="key"><span>On</span></label>
<label><input type="radio" name="toggle" id="key"><span>Off</span></label>
</div>
</form>
<script>
$(document).ready(function() {
$('#urlForm').submit( function() {
goUrl = '/?constraint=' + $('#key').val() + '+' + $('#key2').val();
window.location = goUrl;
return false; // Prevent the default form behaviour
});
});
</script>