标签:function execute Failed fn setSelectionRange input 2016 type setCursorPosition
When I use number input I've got error in Google Chrome
Uncaught InvalidStateError: Failed to execute 'setSelectionRange' on 'HTMLInputElement':
The input element's type ('number') does not support selection.
|
The fix will be something like:
activate: function() {
if(this.$input.is(':visible')) {
this.$input.focus();
var type = this.$input.attr('type');
if (type && type.match(/^(text|search|password|tel|url)$/i) || !type) {
$.fn.editableutils.setCursorPosition(this.$input.get(0), this.$input.val().length);
}
if(this.toggleClear) {
this.toggleClear();
}
}
},
|
@akakoori you might want to look at this Pull request I fixed it by inserting
(function() {
var original = $.fn.editableutils.setCursorPosition;
$.fn.editableutils.setCursorPosition = function() {
try {
original.apply(this, Array.prototype.slice.call(arguments));
} catch (e) { /* noop */ }
};
})();
|
当然,你也可以
min=
"0"
标签:function,
execute,
Failed,
fn,
setSelectionRange,
input,
2016,
type,
setCursorPosition
From: https://blog.51cto.com/u_15976398/6323437