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 8010699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:49:08+00:00 2026-06-04T18:49:08+00:00

I am trying to create a simple interactive form for use with touch screen

  • 0

I am trying to create a simple interactive form for use with touch screen devices. The majority of the form is made up of radio buttons in groups of 5 (approx. 37 groups). I have a label tag for each radio button, and when selected (clicked), the background-color property of the label is changed to a highlighted colour using this JavaScript within each label tag OnClick="this.style.background='#5555ff';"

What I want to add to the above, is a JavaScript that will remove the above if the selection is changed within the group. E.g. A user selected radio button A in group 1, then changes their selection to radio button B in group 1. At the moment, both label backgrounds will be changed to the defined colour.

The HTML form is created dynamically by PHP so radio button names, IDs, & values will differ.

I have been unsuccessful trying to complete this task myself, and there doesn’t seem to be a simple OnUnClick="xxx" either. I have searched on here for a solution but no questions match mine, although I have tried tweaking existing solutions to similar problems but to no avail.

Thank you for reading!

  • 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-06-04T18:49:09+00:00Added an answer on June 4, 2026 at 6:49 pm

    Here you go:

    HTML

    <html>
        <body>
            <div>
            <input type="radio" id="g1v1" name="g1" value="v1" checked="checked"/> <label for="g1v1">V1</label>
            </div>
            <div>
            <input type="radio" id="g1v2" name="g1" value="v2" /> <label for="g1v2">V2</label>
            </div>
            <div>
            <input type="radio" id="g1v3" name="g1" value="v3" /> <label for="g1v3">V3</label>
            </div>
            <div>
            <input type="radio" id="g1v4" name="g1" value="v4" /> <label for="g1v4">V4</label>
            </div>
        </body>
    </html>
    

    Javascript

    $(document).ready(function(){
        var selectedRadioColor = "yellow";
        var normalRadioColor = "gray";
        // For changing color while document loads
        $.each($(":radio"), function(){
            //alert( $(this).prop("id")+ $(this).prop("checked") );
            if($(this).prop("checked") == false)
            {
                $(this).parent().css("color", normalRadioColor);
            }
            else
            {
                $(this).parent().css("color", selectedRadioColor );
            }
        })
        // For updating color when user interacts with radio buttons
        $(":radio").click(function(){
            $("[name='"+$(this).prop("name")+"']").parent().css("color", normalRadioColor);
            $(this).parent().css("color", selectedRadioColor );
    
        })
    })
    

    Here is the link to jsfiddle for live demo:
    http://jsfiddle.net/dharmavir/6UnDs/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to create a simple input box with form validation, but im not
Trying to create a simple form: <%@ Page Language=C# AutoEventWireup=true CodeBehind=register.aspx.cs Inherits=AlphaPack._Default MasterPageFile=MasterPages/Main.master title=Hi
Im trying to create a simple loop that creates 50 buttons, adds them to
I'm trying to create a simple video player with 3 buttons: play, stop and
I'm trying to create an interactive form. Your selections determine the next questions that
I'm trying to create a simple interactive image map where the user would be
I'm trying to use LsaLogonUser to create an interactive logon session, but it always
I am trying to create simple user registration form. I have an index.html file
I'm studying webrat and cucumber and trying to create simple example. Here is my
Im trying to create a simple pan and zoom app using silverlight 4, but

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.