Radio button list validation using JQuery.
if ($("[id$=<%=rbIsactive.ClientID%>]").find("input:checked").length < 1) {
var RB1 = document.getElementById("<%=rbIsactive.ClientID%>");
var radio = RB1.getElementsByTagName("input");
for (var i = 0; i < radio.length; i++) {
if (radio[i].checked) {
break;
}
else if (i == radio.length - 1) {
rvalue = false;
alerts = "Please Select Workflow Status";
radio[0].focus();
}
}
}
This will help you validate radio button list
<asp:RadioButtonList ID="rbIsactive" CssClass="radioButtonList" RepeatDirection="Horizontal" runat="server" ValidationGroup="g">
<asp:ListItem Value="0">Active</asp:ListItem>
<asp:ListItem Value="1">In Active</asp:ListItem>
</asp:RadioButtonList>
if ($("[id$=<%=rbIsactive.ClientID%>]").find("input:checked").length < 1) {
var RB1 = document.getElementById("<%=rbIsactive.ClientID%>");
var radio = RB1.getElementsByTagName("input");
for (var i = 0; i < radio.length; i++) {
if (radio[i].checked) {
break;
}
else if (i == radio.length - 1) {
rvalue = false;
alerts = "Please Select Workflow Status";
radio[0].focus();
}
}
}
This will help you validate radio button list
No comments:
Post a Comment