gpt4 book ai didi

javascript - 如何获取复选框的值

转载 作者:行者123 更新时间:2023-11-29 16:29:21 24 4
gpt4 key购买 nike

如何获取复选框的值?

var tb = new Ext.Toolbar();

tb.add({
xtype: 'checkbox',
boxLabel: 'Expand Groups by Default',
id: 'GetChkBoxValue',
checked: true,
handler: function() {
alert(this.getValue())
}
});

是否可以在 tb 之外获取复选框的值。我做过类似的事情,但没有触发

Ext.getCmp('GetChkBoxValue').getValue(); 

最佳答案

尝试下面的代码,它应该可以工作:

new Ext.Window({
renderTo: Ext.getBody(),
width: 500,
height: 200,
title: 'test window',
items: [{
xtype: 'checkbox',
boxLabel: 'Expand Groups by Default',
id: 'chkid',
checked: true
}]
}).show()
Ext.getCmp('chkid').getValue()

然后使用复选框并使用 getValue() 获取其状态(选中或未选中)。快乐的 ExtJS 编码!

关于javascript - 如何获取复选框的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1941461/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com