![](/img/trans.png)
[英]How sort objects according to value from select element?- mongodb, nodejs
[英]How to select an element according a value
如何根据值选择元素? 例如,我想在RadiobuttonList
控件中选择一个value=2
的输入。
谢谢
你可以试试
$("#<%=rbl.ClientID%> input[value=2]").attr('checked', true);
要么
$('#<%=rbl.ClientID %>').find("input[value=2]").attr("checked", "checked");
注意 rbl是单选按钮列表的ID
$('#{id of RadiobuttonList} input[value="2"]').attr('checked', 'checked')
或对于jQuery 1.6+:
$('#{id of RadiobuttonList} input[value="2"]').prop('checked', true)
您可以使用以下CSS选择器:
input[type="radio"][value="2"]
在jQuery中
$('input[type="radio"][value="2"]')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.