jQuery MiniUI

 找回密码
 立即注册
查看: 4008|回复: 7
打印 上一主题 下一主题

RadioButton 怎样用Js设置 默认选中按钮 [复制链接]

Rank: 3Rank: 3

跳转到指定楼层
楼主
发表于 2013-10-9 14:36:13 |只看该作者 |倒序浏览
版主:好!

请问下:RadioButton 怎样用Js设置 它默认选中按钮。也就是按下去的那个按钮。

这个和RadioButtonList不一样,RadioButtonList它里面可以设置 Value,而RadioButton不知道 怎么设置!


Rank: 8Rank: 8

沙发
发表于 2013-10-9 14:42:58 |只看该作者
obj.findItems(function (e) {
    if (e.xxx== "yyy") {
        e.enabled = false;
    }
})

如果一开始就禁用某些选项,可以在数据上,直接加上enabled:false

Rank: 3Rank: 3

板凳
发表于 2013-10-9 14:45:57 |只看该作者
factory 发表于 2013-10-9 14:42
obj.findItems(function (e) {
    if (e.xxx== "yyy") {
        e.enabled = false;

嗯,我找到一个方法了。直接设置Button的checked="true"即可。

下面的动态判断,最灵活了

obj.findItems(function (e) {
    if (e.xxx== "yyy") {
        e.enabled = false;
    }
})

感谢了!

Rank: 3Rank: 3

地板
发表于 2013-10-9 14:58:46 |只看该作者
factory 发表于 2013-10-9 14:42
obj.findItems(function (e) {
    if (e.xxx== "yyy") {
        e.enabled = false;

刚才,去测试上面代码,正好,想遍历整个Body中的Panel对象。

function findPanel() {
            mini.get("main").findItems(function (e) {
               
                if (e.id== "panel1") {
                    e.enabled = false;
                    mini.alert(e.id);
                }
            });
        }

想查找main这个Div中(或者在整个Body中) 的全部Panel。

可是没有效果,是不是写错了!

Rank: 9Rank: 9Rank: 9

5#
发表于 2013-10-10 10:24:10 |只看该作者
RadioButton我们没有这个控件把,只有RadioButtonList。
如果是RadioButtonList,直接setValue("YYY")就可以了

Rank: 3Rank: 3

6#
发表于 2013-10-10 10:38:48 |只看该作者
niko 发表于 2013-10-10 10:24
RadioButton我们没有这个控件把,只有RadioButtonList。
如果是RadioButtonList,直接setValue("YYY")就可 ...

谢谢,已解决!

Rank: 3Rank: 3

7#
发表于 2013-10-18 14:27:01 |只看该作者
factory 发表于 2013-10-9 14:42
obj.findItems(function (e) {
    if (e.xxx== "yyy") {
        e.enabled = false;


按钮单选组RadioButton的如何设置默认选中项

Rank: 8Rank: 8

8#
发表于 2013-10-18 16:12:24 |只看该作者
wef1991 发表于 2013-10-18 14:27
按钮单选组RadioButton的如何设置默认选中项

给你需要选中的按钮设置checked="true"

Archiver|普加软件

GMT+8, 2024-6-16 06:19 , Processed in 1.039441 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部