You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.
FastClick.prototype.focus = function(targetElement) {
var length;
if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month' && targetElement.type !== 'email') {
// must targetElement.focus() first
length = targetElement.value.length;
targetElement.setSelectionRange(length, length);
} else {
targetElement.focus();
}
};
method setSelectionRange can set selection in a focused input element
and in this example (https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange),
function SelectText () {
var input = document.getElementById("mytextbox");
input.focus();
input.setSelectionRange(2,5);
}
also input.focus() first
so, if you want use setSelectionRange, you must input.focus() first
in my code, click input can not focus, must rewrite FastClick.prototype.focus.
is it a bug in ios?
The text was updated successfully, but these errors were encountered:
FastClick.prototype.focus = function(targetElement) {
var length;
if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month' && targetElement.type !== 'email') {
// must targetElement.focus() first
length = targetElement.value.length;
targetElement.setSelectionRange(length, length);
} else {
targetElement.focus();
}
};
method setSelectionRange can set selection in a focused input element
and in this example (https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange),
function SelectText () {
var input = document.getElementById("mytextbox");
input.focus();
input.setSelectionRange(2,5);
}
also input.focus() first
so, if you want use setSelectionRange, you must input.focus() first
in my code, click input can not focus, must rewrite FastClick.prototype.focus.
is it a bug in ios?
The text was updated successfully, but these errors were encountered: