Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How to get the index of a checked radio button?

user-image
Question added by Zaid Rabab'a , Software Development Team Leader , Al-Safa Co. Ltd.
Date Posted: 2013/09/11
Muhammed Ajmal Seeraveetil
by Muhammed Ajmal Seeraveetil , Software Engineer , Wipro

Please make clear in which language you need to get the indexed value  .Are you tring to get on the server side or cleint side ?

Thanks 

Ajmal

Ashraf Sabry
by Ashraf Sabry , Freelancer developer , N/A

I think you mean jQuery although you didn't clarify.

 

You can use this to get the zero based index:

$(":radio:checked").index()

You may combine it with any parent selectors. For example:

$("form :radio:checked").index()

$(".checkout :radio:checked").index()

$("#registerForm").find(":radio:checked").index()

 

References:

http://api.jquery.com/radio-selector/

http://api.jquery.com/checked-selector/

http://api.jquery.com/index/

Feras Abualrub
by Feras Abualrub , Web Solutions Manager , Qistas for Information Technology

var radioIndex = $(":radio[name='radioFieldName']").index($(":radio[name='radioFieldName']:checked"));

Deleted user
by Deleted user

Index!!!!!!

as I know Radio Btns (RB) are grouped...

so let's say you have3 RB, all of them should have the same  group, and each of them has a value and ID.

You check which one is checked and you get the value.

Or maybe am not getting your question correctly....

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.