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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:07:23+00:00 2026-06-18T08:07:23+00:00

I want to disable or hide the radio button once one has been selected

  • 0

I want to disable or hide the radio button once one has been selected – this is so that the user can t price compare as the radio button is linked to the price and shows the price once the radio button is checked. I am using knockout.js to link the selected radio button and display the price. And have found a way on jquery to hide the not selected radio buttons but I am having trouble merging the two together.

Please see the code below:

<div class="stepTwo">
    <div class="middleTitle">
        <p>
        </p>
    </div>
    <div data-bind="with: bin2ViewModel">
        <div class="divRadiobtns" data-bind="foreach: availableGroups">
            <input type="radio" id="makeOpacityHide" class="radioOptions" name="retailerGroup"
                data-bind="checked: $parent.selectedGroupOption, value: retailerproductId" /><span
                    class="radioOptionsA" data-bind="css: { 'radioOptionsA-checked': $parent.selectedGroupOption()==retailerproductId() }">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
        </div>
        <div data-bind="with: selectedRetailerGroup">
            <span class="actualPrice" data-bind="text: price" />
        </div>
        <div data-bind="with: selectedRetailerGroup">
            <input type="hidden" name="retailerProductId" id="retailerProductId" class="retailerProductId"
                data-bind="value: retailerproductId" />
        </div>
    </div>
</div>
<script type="text/javascript">
//<![CDATA[
    //jquery
    $(document).ready(function () {
        $("input[name$='retailerGroup']").click(function () {
            var test = $(this).val();

            $("input.radioOptionsA").hide();

        });
    });


    //knockout
    var Bin2ViewModel = function () {
        var self = this;
        this.selectedRetailerGroup = ko.observable();
        this.selectedGroupOption = ko.observable();
        this.selectedGroupOption.subscribe(function (newVal) {
            var items = $.grep(self.availableGroups(), function (item) { return item.retailerproductId() == newVal; });
            self.selectedRetailerGroup(items[0]);
        });
        this.selectedGroup = ko.observable();
        this.availableGroups = ko.observableArray(
            [new RetailerViewModel("21290", "£1.80"),
                new RetailerViewModel("302852", "£2.55"),
                new RetailerViewModel("422974", "£2.55")
            ]);
    };


    var RetailerViewModel = function (retailerproductId, price) {
        this.retailerproductId = ko.observable(retailerproductId);
        this.price = ko.observable(price);
    };
    ko.applyBindings({ bin2ViewModel: ko.observable(new Bin2ViewModel()) });
//]]>
</script>

Does anyone know a way of making them work toether or is there a good way to hide the radio buttons in knockout?

http://jsfiddle.net/afnguyen/MMqzv/3/

I have also attached the jquery in a jsfiddle – this shows what i want as the selected radio button class name changes and so should not hide:

http://jsfiddle.net/afnguyen/5mmt2/1/

Thanks

  • 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-18T08:07:24+00:00Added an answer on June 18, 2026 at 8:07 am

    Try this. You can change the css attrib “disabled” to = “disabled”:

        $(".class").attr(
            'disabled', 'disabled'
        );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I disable firebug using Javascript? I want to do this to hide
I want to disable or hide Back button in QWizard dialog. How can I
I want to disable the left bar button when my webview is loading can
if a radio button is selected, i want a div to either show or
hi I want to ask a simple question how I can hide or disable
in one page function i want disable js script. How make that? I try
I have a development version of a website that I want to hide/disable. But
I have a button that performs an ajax post -- I want to disable
How to hide/disable keyboard ,if the textview editing is enabled. I only want to
I want to disable an input Box AND a button when a checkbox is

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.