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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:44:33+00:00 2026-06-15T06:44:33+00:00

I have a code (you can play it at http://learn.knockoutjs.com/#/?tutorial=intro , click Run in

  • 0

I have a code (you can play it at http://learn.knockoutjs.com/#/?tutorial=intro , click Run in output window before playing ):

HTML:

<div class="btn" style="margin-left: 15px;" data-bind="click: includeMyNumber">
   <input data-bind="checked: isIncludeMyNumber" data-val="true" id="IncludeMe" name="IncludeMe" style="margin: 0" type="checkbox" value="true" />&nbsp;
   Include my number (+<span>11111111111</span>) 
</div>

Javascript:

 // This is a simple *viewmodel* - JavaScript that defines the data and behavior of your UI
function AppViewModel() {

    this.isIncludeMyNumber = ko.observable(false);

    this.includeMyNumber = function(){
       this.isIncludeMyNumber(!this.isIncludeMyNumber());
    }
}

// Activates knockout.js
ko.applyBindings(new AppViewModel());

The problem is that checkbox click event handling does not work properly. When I click the space inside [div class=”btn”…] …[/div] area, checkbox behaviour is OK, but when I click the checkbox itself, it is not checked. How can I make it checkable in any case?

Thank you.

  • 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-15T06:44:35+00:00Added an answer on June 15, 2026 at 6:44 am

    You´re use case is to make the checkbox checked when clicking the text?

    I made a binding for this in my custom binding collection

    https://github.com/AndersMalmgren/Knockout.Bindings

    http://jsfiddle.net/5nqw4/

    <input data-bind="checked: checked, label: { caption: 'Label with reference to input' }" type="checkbox" />
    

    edit: You can also fix this by using the standard hack of wrapping the checkbox in a label element like http://jsfiddle.net/7dTfM/

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

Sidebar

Related Questions

You can play with my code here: http://jsfiddle.net/gqQnd/ Basically I want to have a
I have this code so I can grab the values ind the dataset before
I am reading this tutorial http://developer.android.com/guide/google/play/billing/billing_testing.html and it is really confusing me :) In
I have a subclass of UITableViewController. I have code that can add/remove a UISearchBar
I have this code which can display drop down in div tag of html.
I have this code ,now can anyone reply s what happens to the lock
I have this code and can't figure out what seems to be the problem:
I have code in my Page_load method that can take up to a few
I have code that uses jquery.slideup and jquery.slidedown How can i know that div
I currently have code in objective C that can pull out an integer's most

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.