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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:27:14+00:00 2026-06-01T03:27:14+00:00

Preface I’ve rarely ever been a JS developer and this is my first attempt

  • 0

Preface

I’ve rarely ever been a JS developer and this is my first attempt at doing something with Knockout.js. The question to follow likely illustrates both points.

Backgound

I have a fairly complex MVC3 application that I’m trying to get to work with KO (v2.0.0.0). My MVC app is designed to generically control which fields appear in the view (and how they are added to the view). It makes use of partial views to decide what to draw in the view based on the user’s permissions (If the user is in group A then show control A, if the user in group B then show control B or possibly if the user is in group A don’t include the control at all). Also, my model is very flat so I’m not sure the built-in ability to apply my ViewModel to a specific portion of the view will help.

My solution to this problem is to provide an action in my controller that responds with an object in JSON format with that contains the JQuery selector and the content to assign to the “data-bind” attribute and bind the ViewModel to the View in the $(document).ready event using the values provided.

Failed Proof-of-concept

My first attempt at proving that this works doesn’t actually seem to work, and by “doesn’t work” I mean it just doesn’t bind the values at all (as can be seen in this jsfiddle). I’ve tried it with the applyBindings inside of the ready event and not, but it doesn’t seem to make any bit of difference.

Question

What am I doing wrong? Or is this just not something that can work with KO (though I’ve seen at least one example online doing the same thing and it supposedly works)?

Like I said in the preface, I’ve only ever pretended to be a JS developer (though I’ve generally gotten it to work in the past) so I’m at a loss where to start trying to figure out what I’m doing wrong. Hopefully this isn’t a real noob question.

  • 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-01T03:27:15+00:00Added an answer on June 1, 2026 at 3:27 am

    Are you sure you’ve referenced the Knockout library? I got your fiddle to work by simply referencing Knockout:

    fiddle

    In your own page, you can use the script tag to do so:

    <script src="pathToKnockoutJsFileOnYourServer" type="text/javascript"></script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

( Preface: This is my first audio-related question on Stack Overflow, so I'll try
Let me preface this question with first stating that I'm new to GUI interfaces:
First let me preface this question by saying that I'm fairly new to Javascript.
To preface this question, this is my first app and I have a very
Let me preface this question by saying that I am a .NET developer at
Preface: First time really using JavaScript + jQuery, so my problem likely stems from
Preface: This question is about a project I am working on with a professor
I want to preface this question by stating that I am fairly new to
I'll preface my question by saying that I'm a beginner objective-c developer. What is
I'll preface this question with the note that I have looked at this similar

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.