[英]Mootools set radio button checked
I have 2 radio buttons 我有2个单选按钮
and I used mootool while loading as 我在装载时使用了mootool
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. 任何帮助将不胜感激......以及没有if条件的任何其他简短解决方案。
您提供的代码工作正常 - 这是一个测试用例: 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.
在addEvent函数的末尾。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.