/    Sign up×
Community /Pin to ProfileBookmark

Custom Radio Button groups

Hello,

I created a custom radio and checkbox script. However Im having trouble with the Radio Buttons. How do I get it so that radio buttons that have the same name should be treated as a group. (link below) So if I have:

[CODE]
<input type=”radio” name=”sex” id=”female” />
<input type=”radio” name=”sex” id=”male” />
[/CODE]

So here in the example above you should only be allowed to select one. Since the name attribute is the same in the both of them.

Please feel free to critique the script and offer pointers as well.

Im really stuck on this situation, though.

LINK : [url]http://mikewgd.com/wp-content/portfolio/JavaScript/custom-form-elements.html[/url]

Thank you

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Logic_AliJan 27.2012 — 
<i>
</i>&lt;input type="radio" name="sex" id="female" /&gt;
&lt;input type="radio" name="sex" id="male" /&gt;
So here in the example above you should only be allowed to select one. Since the name attribute is the same in the both of them.

[/quote]

That is the default behaviour for radio buttons, including on your page if you disable the script. What is your script trying to change?
×

Success!

Help @mikewgd spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...