留言板

How to get radio input value by using A.one?

Jacky Mak,修改在10 年前。

How to get radio input value by using A.one?

New Member 帖子: 22 加入日期: 13-12-19 最近的帖子

<aui:field-wrapper label="">
		<aui:input inlineLabel="right" name="gender" type="radio" value="1" label="male" />
		<aui:input checked="<%= true %>" inlineLabel="right" name="gender" type="radio" value="2" label="female" />
	</aui:field-wrapper>



How can i get the checked radio input value by using A.One ????

Thanks
thumbnail
Byran Zaugg,修改在10 年前。

RE: How to get radio input value by using A.one?

Expert 帖子: 252 加入日期: 12-4-6 最近的帖子
I would grab the <form> and access the inputs from there.

var myFormNode = A.one('#myFormId');
console.log(myFormNode.getDOMNode().myInputName.value);


Do you need the A.Node?
var myFormEl = document.getElementById('myFormId');
console.log(myFormEl.myInputName.value);
thumbnail
Byran Zaugg,修改在10 年前。

RE: How to get radio input value by using A.one?

Expert 帖子: 252 加入日期: 12-4-6 最近的帖子
Ah, there is also:
http://stackoverflow.com/a/4385007/218161

var value = A.one("#test input[name=test1]:checked").get("value");