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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:33:25+00:00 2026-05-25T06:33:25+00:00

How do I disable a radio button with knockout.js? I don’t want the user

  • 0

How do I disable a radio button with knockout.js? I don’t want the user to be able to select it. My template below isn’t working.

<div id="answers" data-bind="template: { name: 'answerTmpl', data: interactive.answers }">
    </div>

    <script id="answerTmpl" type="text/html">

        {{each(index, value) $data}}
        <div>
            <input type="radio" value="${index}" name="Answer" data-bind="disable: app.viewModel.avatars.speaking, checked: app.viewModel.interactive.answerSelected"/> <span>${value}</span> 
        </div>
        {{/each}}
    </script>

app.avatars.js

(function (app, $, undefined) {

    app.viewModel = app.viewModel || {};

    app.viewModel.avatars = {
        speaking: ko.observable(false),
        loaded: ko.observable(false)
    };

app.interactive.js

(function (app, $, undefined) {

    app.viewModel = app.viewModel || {};

    app.viewModel.interactive = {
        timeout: 1500,
        answers: ko.observableArray(),
        answerSelected: ko.observable(''),
        correctAnswer: ko.observable(-1),
        bookPage: ko.observable(1),
        chapterEmail: ko.observable(''),
        trialogue: {
            inProgress: ko.observable(false),
            response: ko.observable(''),
            conversation: ko.observableArray()
        }
    };

    app.interactive.init = function () {
         ko.applyBindings(app.viewModel);
    };
  • 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-25T06:33:26+00:00Added an answer on May 25, 2026 at 6:33 am

    When you are using global variables instead of bound data, it looks like you need to explicitly evaluate the functions: http://jsfiddle.net/nFgnj/

    <input type="radio" value="${index}" name="Answer" 
        data-bind="disable:app.viewModel.avatars.speaking(),
                   checked:app.viewModel.interactive.answerSelected()" />
    

    I don’t really like this solution, because it relies on app being a global variable.

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

Sidebar

Related Questions

Problem: I'm attempting to disable a radio button by using the code below. This
Details: Only disable after user clicks the submit button, but before the posting back
How can i set selected = true and disable this radio button <%= Html.RadioButtonFor(m
can any one tell me how can we enable/ disable button by radio button
How to disable one of the radio button from 4 radio buttons after the
Not getting value of radio button which i disable using JQuery before page submit.
I need help writing Jquery to disable a group of radio button when one
I'm attempting to disable a radio button from an asp RadioButtonList using JavaScript. Here
Is it possible to disable standard action being performed while clicking radio button? (without
I have a simple form with some radio buttons. I want to disable some

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.