0

This can be seen on Knockout.js site as well.

When I open this page in IE11 or FF 38, and go to Example 2: Click-to-edit and click on the Name - Bert Bertington, the Caret (cursor) of textbox is at the start of text, while in Chrome it is at the end.

If this is a feature, could somebody suggest how to keep the caret in the end when the label changes to textbox in IE11 and FF38.

I was able to fix this in FF38 by resetting the contents of observable as below, but his does not work in IE11.

    var str = self.msg();
    self.msg('');
    self.msg(str); 

I am using knockout-3.2.0 if that matters.

UPDATE

The issue seems to be with browsers rather than Knockout (sorry for the confusion).

I tried setting focus of the text field using JQuery and javascript .focus() functions and am still getting same result on IE11 and Firefox 38.

Any help would be appreciated.

doydoy44
  • 5,720
  • 4
  • 29
  • 45
Guanxi
  • 3,103
  • 21
  • 38

1 Answers1

0

You are correct, this is an issue of how different browsers handle the focus event. A workaround would be to manually set the cursor to the end of the text within the textbox.

An example of doing this can be found here. If you want this to happen automatically using knockout, you would have to create your own custom binding based on the hasFocus binding, or modify the KnockoutJS library directly. The focus event is triggered on line 3813 of the Knockout 3.2.0 non minified JS file.

Community
  • 1
  • 1
jonesy827
  • 302
  • 3
  • 11