Answers for "input on focus"

13

set focus javascript

document.getElementById("ThingToSetFocusOn").focus();
Posted by: Guest on February-11-2020
1

html prevent focus on input

<input type="text" id="yourID" value="test" readonly="readonly" /> 

You can change it in javascript with : 

document.getElementById("yourID").readOnly = false; //This enables the possibility to focus
Posted by: Guest on November-29-2020
2

js focus event

const form = document.getElementById('form');

form.addEventListener('focus', (event) => {
  event.target.style.background = 'pink';    
}, true);

form.addEventListener('blur', (event) => {
  event.target.style.background = '';    
}, true);
Posted by: Guest on November-04-2020
0

focus on input

document.getElementById("myText").focus();
Posted by: Guest on April-19-2021
0

focus on input

$("input:text:visible:first").focus();
Posted by: Guest on April-18-2021

Browse Popular Code Answers by Language