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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:14:38+00:00 2026-06-15T13:14:38+00:00

I am trying to learn knockOut.js and can’t really get off the ground. When

  • 0

I am trying to learn knockOut.js and can’t really get off the ground. When I call ko.applyBindings, my model is always undefined.

I’ve tried the solution already answered here.

I have also tried in jsFiddle: here

I have the following htm form:

<head>
   <title>Mashup</title>
   <script src="Scripts/jquery-1.8.2.js" type="text/javascript"></script>
   <script src="Scripts/knockout-2.2.0.js" type="text/javascript"></script> 
</head>

//html body    

 <script type="text/javascript">

   $(window).load(function () {

       function AppViewModel() {
           this.firstName = ko.observable("Bert");
           this.lastName = ko.observable("Bertington");
       }

       var model = ko.applyBindings(new AppViewModel());
       alert(model);
   });

I’ve also tried using document ready:

   //I've also tried document ready but still not working.

   $(document).ready(function () {
       function AppViewModel() {
           this.firstName = ko.observable("Bert");
           this.lastName = ko.observable("Bertington");
       }

    var model = ko.applyBindings(new AppViewModel());
    alert(model);
});

I know ir will be something really stupid. Can anyone help please?

  • 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-15T13:14:39+00:00Added an answer on June 15, 2026 at 1:14 pm

    You do make two mistakes:

    1. ko.applyBindings() does not return the model.

      // Create the view model
      var model = new AppViewModel();
      
      // Apply bindings using this model
      ko.applyBindings(model);
      
    2. In your fiddle, you’re trying to use the “value” binding on a <label> element. Such elements have no “value” property since you cannot enter anything. You need to use the “text” binding here:

      <label id="lblFilename" data-bind="text: firstName"></label>
      

    http://jsfiddle.net/4748N/8/

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

Sidebar

Related Questions

Trying to learn Sencha Touch 2 and I can't seem to find out how
I was trying learn lex and yacc using the oreilly book. I tried following
I'm currently trying to learn Knockout.JS - I'm also relatively new to JavaScript itself.
While trying to learn c++, I tried to implement class representing very basic trie.
i`m trying to learn classes, and something is holding em back, i get NameError:
Just trying to learn C++. I'm starting off with a scraper. The idea is
Trying to learn PL/SQL with multimedia data. Can anyone please point out that from
I am trying to learn knockout and have come up against a problem. I
I am trying to learn knockout. I am wanting to build an input form
Trying to learn shaders and get a dead simple directional light source working 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.