knockout.js - hasFocus not working
knockout.js
Solution
This is bug in the knockout framework and its fixed in knockoutjs3.0.0. You can donwload latest knockout library using nuget package manager
Problem
I am trying to implement simple demo code which uses 'hasFocus' binding. Sample code is available here It is also working fine in the browser (IE) When I copy same code and paste it in my MVC application it stops working. Even if after clicking on button its not setting focus on text box. Below is my code: ``` <div> <div> <input data-bind="hasFocus: isSelected" /> <button data-bind="click: setIsSelected">Focus programmatically</button> <span data-bind="visible: isSelected">The textbox has focus</span> </div> </div> @section scripts{ <script type="text/javascript" src="@Url.Content("~/Scripts/jquery-1.7.1.js")"></script> <script type="text/javascript" src="@Url.Content("~/Scripts/knockout-2.1.0.js")"></script> <script type="text/ecmascript" src="@Url.Content("~/Scripts/jquery-ui-1.8.20.js")"></script> <script> $(function () { var viewModel = { isSelected: ko.observable(false), setIsSelected: function () { this.isSelected(true) } }; ko.applyBindings(viewModel); }); </script> } ``` Does anyone know what has went wrong here?