1

I wan to retain my cursor position for my HTML number field.

    $(element).bind('keyup', function (e) {
           element.val(f($(this).val(),allowDecimals, false));
           this.setSelectionRange(0,1);
    });

As I understand this can be done in text fields but not in number fields.

Updating an input's value without losing cursor position

is there any way that I can obtain the current curser position and retain it in HTML number field?

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
Sanath
  • 4,774
  • 10
  • 51
  • 81

1 Answers1

1

The best way is to avoid the number type and use a text type. http://blakeembrey.com/articles/angular-js-number-validation-bug/

Sanath
  • 4,774
  • 10
  • 51
  • 81