我试图在选中时更改所选单选按钮文本上的文本颜色(一组三个)。它不起作用。我已经尝试了多种变体,但这应该可以工作
$(document).ready(function() {
if (
$('.radioPanel [input:radio]').is(":checked")) {
$(this).css('color', '#008000');
}
});
这是aspx代码;外部代码是否影响 jquery 更改?
<fieldset class="registerradio">
<legend>Select a Category</legend>
<asp:Panel ID="radiobtnPanel" runat="server" CssClass="radioPanel">
<asp:RadioButton ID="radioUserEmployee" runat="server" GroupName="radioCreateUsers" Text="Employee" TextAlign="Left" />
<asp:RadioButton ID="radioUserDistributor" runat="server" GroupName="radioCreateUsers" Text="Distributor" TextAlign="Left"/>
<asp:RadioButton ID="radioUserCustomer" runat="server" GroupName="radioCreateUsers" Text="Existing Customer" TextAlign="Left"/>
<%--<asp:RadioButton ID="radioUserOther" runat="server" GroupName="radioCreateUsers" Text="Other" TextAlign="Left"/>--%>
</asp:Panel>
</fieldset>
这是小提琴; http://jsfiddle.net/6yVL3/