I have 2 radio buttons
and I used mootool while loading as
window.addEvent('domready', function() {
var chk="1";
if(chk==1){
$('edit-gender-0').set('checked',true);
}
else if(chk==2){
$('edit-gender-1').set('checked',true);
}
but it is not working at all.
Any help will be appreciated... and any other short solution without the if-condition.
The code you've provided works just fine - here's a test-case: http://jsfiddle.net/oskar/tM29a/
window.addEvent('domready', function() {
var chk="1";
if(chk==1){
$('edit-gender-0').set('checked',true);
} else if(chk==2){
$('edit-gender-1').set('checked',true);
});
don't forget to add }); at the end of the addEvent function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With