Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 751721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:41:57+00:00 2026-05-14T14:41:57+00:00

I have a bunch of optional write-in values for a survey I’m working on.

  • 0

I have a bunch of optional “write-in” values for a survey I’m working on.

These are basically a radio button with a textbox within the answer field – the idea being that you would toggle the button and write something into the box.

What I’d like to do is have the radio button toggled whenever a user clicks in the text field – this seems like a use-case that makes a lot of sense.

Doing this:

<input type="radio" id="radiobutton"><label for="radiobutton">Other: <input type="text" id="radiobutton_other"></label>

works fine in Chrome (and I am guessing, other WebKit browsers as well), but there are weird selection issues in Firefox, so I’m assuming its a non-standard practice that I should stay away from.

Is there a way to replicate this functionality without using JavaScript? I have an onclick function that will work, but we’re trying to make our site usable for people who might have NoScript-type stuff running.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:41:57+00:00Added an answer on May 14, 2026 at 2:41 pm

    Putting an input inside a label actually has a slightly different meaning. It doesn’t make the input itself a label, it implicitly associates the label with the input in the same way as if they were linked by a for/id.

    However, this only happens when the label doesn’t already have a for attribute to override that (see HTML4 s17.9: “When present, the value of this attribute must be the same as the value of the id attribute of some other control in the same document. When absent, the label being defined is associated with the element’s contents.”). It is unclear according to spec what should happen when both containment and for are present.

    (And also it doesn’t work in IE, which makes the point moot in practical terms.)

    No, you’ll need some scripting for this.

    <input type="radio" id="radiobutton">
    <label for="radiobutton_other">Other:</label>
    <input type="text" id="radiobutton_other">
    
    <script type="text/javascript">
        var other= document.getElementById('radiobutton_other');
        other.onchange=other.onkeyup= function() {
            if (this.value!=='')
                document.getElementById('radiobutton').checked= true;
        };
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a core data object that has a bunch of optional values. I'm
week DKK id=radio2 value=75 /> I have bunch of these div entry generated by
i have bunch of buttons within linear layout. But there is spaces buttons. I
For example I have bunch of functions like these: function a() { //do something
I have a form with various inputs. I have a bunch of optional parameters
I have a bunch of these and when the user clicks Maximize the div
I have bunch of strings, some of which are fairly long, like so: movie.titles
I have bunch of lists like this: out[3] [[3]] [1] forum=28&mid=11883 [2] forum=29&mid=11884 out[4]
We have bunch of Domain Entities which should be rendered to an html format,
I have a bunch of business class with autoproperties : public class A {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.