I have two hidden radio buttons and one visible button. Clicking this button should toggle which button is checked.
I can achieve this using if statements and just setting radio button (ID) = checked.
But how can this be achieved with the least ammount of code?
update
To sattisfy those who’s got nothing better to do than complain about missing code. Altough, I don’t see how this will make the question more constructive.
<div class="switch">
<input id="check1" type="radio" name="search" class="rbtn-search" checked="checked" value="brand" />
<input id="check2" type="radio" name="search" class="rbtn-search" checked="" value="store" />
</div>
$('.switch').click(function(){
// Switch the radio buttons here
})
See DEMO
HTML
JavaScript