implement focus input
This commit is contained in:
parent
e3fdf742e7
commit
9384fd07d5
3 changed files with 16 additions and 0 deletions
10
src/content/focuses.js
Normal file
10
src/content/focuses.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
const focusInput = () => {
|
||||
let inputTypes = ['email', 'number', 'search', 'tel', 'text', 'url'];
|
||||
let inputSelector = inputTypes.map(type => `input[type=${type}]`).join(',');
|
||||
let target = window.document.querySelector(inputSelector + ',textarea');
|
||||
if (target) {
|
||||
target.focus();
|
||||
}
|
||||
};
|
||||
|
||||
export { focusInput };
|
Reference in a new issue