2
Reply

which ID is used in javascript function

Rameshyadav Medaboina

Rameshyadav Medaboina

Jul 16 2016 5:20 PM
290
In my web page am using 2 radio buttons & 1 button ,,by default both radio buttons are false,,,then am click the button i got one alert message will come i.e please select any one radio button .........
  <asp:RadioButton ID="rdb1" runat="server" Text="option1" GroupName="group1" onclick="check();" />
<asp:RadioButton ID="rdb2" runat="server" Text="option2" GroupName="group1" onclick="check();"/> <br />
<asp:Button ID="btn1" runat="server" Text="submit" OnClick="btn1_Click" /><br />
<asp:Label ID="lbl1" runat="server" />
 
 
function check()
{
if(document.getElementById("<%=x.ClientID%>").value=="")
{
alert("please select any one button");
return false;
}
else
{
alert("you enetered"+document.getElementById("<%=x.ClientID%>").value)
return true;
}
 
 
 here in this javascript function which ID is used in the place of "x"

Answers (2)