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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:53:18+00:00 2026-05-16T07:53:18+00:00

The problem is mostly summed up in the title. I am using the custom

  • 0

The problem is mostly summed up in the title.

I am using the custom radio/checkbox code from accessible_custom_designed_checkbox_radio_button_inputs_styled_css_jquery/

This is the jist of their code (I modified it to allow defining different style depending on the label’s title)

$(this).each(function(i){   
        if($(this).is('[type=radio]')){
            var input = $(this);
            
            // get the associated label using the input's id
            var label = $('label[for='+input.attr('id')+']');

            
            var labelTitle = label.attr('title');

            // wrap the input + label in a div that has class "custom-radio-LabelTitle"
            $('<div class="custom-radio-' + labelTitle + '"></div>').insertBefore(input).append(input, label);
            
            
            // find all inputs in this set using the shared name attribute
            var allInputs = $('input[name='+input.attr('name')+']');
            
            
            //bind custom event, trigger it, bind click,focus,blur events                   
            input.bind('updateState', function(){   
                if (input.is(':checked')) {
                    if (input.is(':radio')) {               
                        allInputs.each(function(){
                            $('label[for='+$(this).attr('id')+']').removeClass('checked');
                        });     
                    };
                    label.addClass('checked');
                }
                else { label.removeClass('checked checkedHover checkedFocus'); }

            })
            .trigger('updateState')
            .click(function(){ 
                $(this).trigger('updateState'); 
            })
        }
    });

From my understanding, their code basically finds all the radio inputs and then defines a special trigger called updateState. Then they trigger it inside the input’s click function.

So every time the input radiobutton is clicked, updateState is trigger, which in turn sets a class for that radiobutton’s label. The changing of the class changes the CSS of the label.

When the label is clicked, The input that the label is for is also clicked (JQuery’s .click() function is ran).

What I did was set all my input radiobuttons to display:none. That way the user only clicks the label, and secretly they clicked a radio button.

The .click() function won’t run for the input if the input is hidden.

I assume there are two ways pass this:

  1. instead of have the radio’s .click() function trigger the handlestate, have the label’s .click() function handle it instead. This may not work right though, because then the radio button may not actually be clicked (which messes up my form)

  2. when the label is clicked, trigger the radio’s click function manually. However, this may cause it to be triggered twice in every browser but IE. I don’t know how to reference the label’s radio nor to stop it from triggering twice.

  • 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-16T07:53:19+00:00Added an answer on May 16, 2026 at 7:53 am

    I got what I wanted with:

    $("label[title='Plan']").click(function() {
        var id = $(this).attr('for')
        $("input[id='"+id+"']").trigger("click");
        $("input[id='"+id+"']").trigger("updateState");
        PlanChange();
    });
    

    Then removed all the onClicks.

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

Sidebar

Related Questions

I have researched this problem but it is mostly from people who want to
I'm mostly convinced that there is an answer to this problem, but for the
Problem: I'm streaming my video from a php file with stream_get_contents(); using Flowplayer as
My problem is mostly like this: strange out of memory issue , and I
Below is the code for my autocomplete. The problem is that it mostly works.
This is mostly a philosophy question, as the actual problem is solved. The SDK
Problem: Been struggling to get my code to load external shaders and it is
Problem in MATLAB Code for solving desired 'n' number of simultaneous equations of the
Problem: I am trying to build a recursive tree using a function and data
Problem Using Director 11.5 and Windows 7, with MouseWheel Xtra (wheelmouse.zip), I have the

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.