I use 4 radio button with the same name , and with same className, When Ever I try to get the value by using JavaScript it gave an value "Undefind" ,How to over come this????

alert(document.getElementsByName(m1).value);

this is used by me to get the value of m1 name radio button with 4 diffrent value.. Please help me ...

Recommended Answers

All 3 Replies

Well with JQuery in general you could get it with '$('#idgoeshere').val();' or '$('.classgoeshere').val();' etc. I'm not sure if Radio buttons work differently though.

Actually we have same name with different button , only the first button return value else are return undefined .

Member Avatar for iamthwee

Your radio buttons have to be unique in some way, class id, name.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.