Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

onfocus js

const password = document.querySelector('input[type="password"]');

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

password.addEventListener('blur', (event) => {
  event.target.style.background = '';
});
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #onfocus #js
ADD COMMENT
Topic
Name
8+6 =