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

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.

Jump to Post

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 .

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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.