有没有办法在单选按钮列表中的输入项上设置CSS类?我想在jQuery中通过类来引用这些表单值。
给定一个ASP.NET RadioButtonList与ListItems上设置的类:
<asp:RadioButtonList ID="RadioButtonList" runat="server"> <asp:ListItem class="myClass" Text="Yes" Value="1" /> <asp:ListItem class="myClass" Text="No" Value="0" /> </asp:RadioButtonList>
将呈现为:
<span id="RadioButtonList" class="radioButtonListField myClass"> <span class="myClass"> <input id="RadioButtonList_0" type="radio" value="1" name="RadioButtonList"/> <label for="RadioButtonList_0">Yes</label> </span> <span class="myClass"> <input id="RadioButtonList_1" type="radio" value="0" name="RadioButtonList"/> <label for="RadioButtonList_1">No</label> </span> </span>
不幸的是,“myClass”类会添加到< span>包含单选按钮项,而不是< input>本身。我怎么可能让它看起来像这样:
<span id="RadioButtonList" class="radioButtonListField myClass"> <span> <input id="RadioButtonList_0" class="myClass" type="radio" value="1" name="RadioButtonList"/> <label for="RadioButtonList_0">Yes</label> </span> <span> <input id="RadioButtonList_1" class="myClass" type="radio" value="0" name="RadioButtonList"/> <label for="RadioButtonList_1">No</label> </span> </span>
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。