Html radio button label clickable

By: Puhovec Date: 18.06.2017

HTML Tag

I'm creating a quiz web application using PHP. The current HTML for a single question looks like:. I would like the user to have the option of clicking on the text associated with radio button. Right now, the user can only click on the radio button itself - which I find to be a quite cumbersome task. I read Unable to select a particular radio button choice by clicking on the choice text and the suggestion points toward making the for and id attributes of the tags match.

I have done this and it still doesn't work. I know I've read about this before but can't seem to find any solution to my problem. Any help or suggestions are much appreciated! In your code, you've got a label on the form itself. You want to put labels on each individual radio group, as shown below.

How do I make Radio Button label clickable?

You should keep in mind that two elements should never have the same ID. The name attribute is used so that the radio buttons function as a group and only allow a single selection at a time.

There seems to be a little unclickable space between the radio button and the label if done according to Nathan 's answer. Here is how to make them join seamlessly see this article:.

html - How to make the radio button clickable on text - Stack Overflow

The label tag should be around each answer, e. By posting your answer, you agree to the privacy policy and terms of service. Stack Overflow Questions Developer Jobs Documentation beta Tags Users. Sign up or log in to customize your list. Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us.

html radio button label clickable

Log In Sign Up. Join the Stack Overflow Community. Stack Overflow is a community of 7. Join them; it only takes a minute: Clicking the text to select corresponding radio button Ask Question. The current HTML for a single question looks like: Abundnce10 2 10 Zze 4, 1 19 Nathan 2, 7 29 Here is how to make them join seamlessly see this article: I prefer this answer.

But are you sure you even need the "for" attributes with this approach? I think you're right, so I've updated my answer. But if you do this Guero 5, 4 9 Samuel Chen 1 1.

Sign up or log in StackExchange. Sign up using Facebook.

Sign up using Email and Password. Post as a guest Name. Stack Overflow works best with JavaScript enabled. MathOverflow Mathematics Cross Validated stats Theoretical Computer Science Physics Chemistry Biology Computer Science Philosophy more 3. Meta Stack Exchange Stack Apps Area 51 Stack Overflow Talent.

inserted by FC2 system