Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
javascript

C#
function radiobtn(obj) {
           alert(obj.getAttribute('id'));
       }


my alert shows nothing

even i tried

function radiobtn(obj) {
alert(obj.id);
}


asp.net code

<asp:RadioButton runat="server" OnChange="return radiobtn(this)" Text="Answer" ID="chkanswer" />


i also tried

<asp:RadioButton runat="server" OnChange="return radiobtn(this.id)" Text="Answer" ID="chkanswer" /> and
C#
function radiobtn(id) {
           alert(id); 


nothing worked
Posted
Updated 28-May-14 19:20pm
v2
Comments
Nirav Prabtani 29-May-14 1:54am    
have you used masterpage??
Member 10843538 29-May-14 9:25am    
yes

C#
function radiobtn(obj) {
           alert(obj.id);
       }


hope this helps you.. :-)
 
Share this answer
 
Try this.
getElementByID(your radiobutton id)

your code...
 
Share this answer
 
var rdbVlaue=document.getElementByID('rdnCtrl').Value;


Regards,
Praveen Nelge
 
Share this answer
 
document.getElementByID('chkanswer')
 
Share this answer
 
This Is Might Solution..First You Get The Specific id..
..In Javascript Main Thing Is To Get ID Of Particular thing To Change
..
var ChkRadioBtn = document.gEt.ElementById("Id Of RadioButton Specify Here");
..
Thanks..;-)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900