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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:01:31+00:00 2026-06-16T04:01:31+00:00

I am new to knockout js and need help. I want, when I will

  • 0

I am new to knockout js and
need help.
I want, when I will add number in text box division should resize to that size of pixel.

Following is the code:

    <html> 
        <head> 
            <style type="text/css"> 
                #myDiv { 
                        border:solid 1px #f00; 
                } 
                #myOtherDiv { 
                        border:solid 1px #00f; 
                        width: 150px; 
                } 
            </style> 
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
            <script src="http://cdnjs.cloudflare.com/ajax/libs/knockout/2.1.0/knockout-min.js"></script>
            <script type="text/javascript">
                $(document).ready(function(){

                     var viewModel = { 
                            myWidth: ko.observable( '250px'), 
                            anotherDiv: ko.observable('KO is working') 
                        }; 
                        ko.applyBindings(viewModel); 
                });
            </script>
        </head> 
            <body>
                    <div id="myDiv" data-bind="style: { width: myWidth }">
                       Some Text 
                    </div> 
                    <div id="myOtherDiv"> 
                            Some More Text 
                    </div> 
                    <div data-bind="text: anotherDiv"></div> 
                    Enter size<input type = text />
            </body> 
    </html>
  • 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-16T04:01:33+00:00Added an answer on June 16, 2026 at 4:01 am

    You should bind input field tomyWidth property:

    Enter size <input type = text data-bind="value: myWidth"/>
    

    Also link to knockout is broken try this one: http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.0.js

    Here is a working fiddle: http://jsfiddle.net/wAYqY/

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

Sidebar

Related Questions

I have just started using Knockout and I want to filter my data that
I am new to knockout js. I need to have a validator for date
I am new to Knockout JS. I need to bind nested arrays as folows
All the knockout examples I have found seem to add a new item to
I am new to Knockout Js..I have this issue on my page that when
I am new to Knockout.js, I have created an observable array and initialized with
I'm a new user to knockout.js and so far have been very impressed with
new on ruby and using windows xp and rails 3, i want to send
New to Regex. I want to validate to this format: Any character allowed, except
I'm using Knockout observables to update span values located within table cells. I need

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.