javascript - YUI Checkbox Button - retrieving the checked value - Stack Overflow

(I've tried posting this on YUI message group but without any luck)Can anyone tell me how to retri

(I've tried posting this on YUI message group but without any luck)

Can anyone tell me how to retrieve the checked state of a yui Button? I've tried by creating the Button in code, which is then outputted as a HTML button but this only changes the title attribute.

When I use checkboxes instead, none of the checkboxes are checked (when iterating through them with jQuery).

Is there an easier way of doing it? Say with the 3.0 Node API, or Element?

EDIT: To clarify how this problem came about, I'm using the YUI ASP.NET controls. They add controls to the page like this

Sys.Application.add_init(function() {    $create(YUIAspNet.Button, {"ButtonID":"yuiMyButton_btn","ButtonName":"yuiMyButton$btn","TabIndex":0,"ButtonType":"checkbox","Text":"Technology"}, null, null, $get("yuiMyButton"));});

So as you can see, finding all buttons is not as simple as I'd like it to have been.

(I've tried posting this on YUI message group but without any luck)

Can anyone tell me how to retrieve the checked state of a yui Button? I've tried by creating the Button in code, which is then outputted as a HTML button but this only changes the title attribute.

When I use checkboxes instead, none of the checkboxes are checked (when iterating through them with jQuery).

Is there an easier way of doing it? Say with the 3.0 Node API, or Element?

EDIT: To clarify how this problem came about, I'm using the YUI ASP.NET controls. They add controls to the page like this

Sys.Application.add_init(function() {    $create(YUIAspNet.Button, {"ButtonID":"yuiMyButton_btn","ButtonName":"yuiMyButton$btn","TabIndex":0,"ButtonType":"checkbox","Text":"Technology"}, null, null, $get("yuiMyButton"));});

So as you can see, finding all buttons is not as simple as I'd like it to have been.

Share Improve this question edited Jun 16, 2015 at 14:27 Dylan Corriveau 2,5554 gold badges30 silver badges36 bronze badges asked Jan 19, 2009 at 14:37 Chris SChris S 65.5k53 gold badges224 silver badges240 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

Sorry are you talking about checkbox buttons? Use:

myButton.get("checked")

where myButton is an instance of YAHOO.widget.Button.

Chris, I am the starter of YUI ASP.NET project. I watch the YUI mailing list regularly, I must of missed your question.

I have a more general answer for you and anyone else having the problem and ending up reading this, not just for checkbox button, but for all controls.

On the client, you can have access to the YUI object by calling the .get_YUIControl() method on the custom wrapper client object, then you have the control over the original YUI object. The YUI documentation is very good, and you can find a good description for what you'd like to acplish.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744246343a4564951.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信