Tester si un input a le focus sans onFocus
Bonjour à tous !
J'ai un input de type text et j'ai besoin de tester s'il a le focus dans un script.
J'ai essayé ces formules dans une fonction mais aucune ne fonctionne.
Code:
if (document.getElementById('TextboxSicovam').focus == true)
Code:
if (document.getElementById('TextboxSicovam').focus)
Code:
if (document.getElementById('TextboxSicovam').Focus == true)
Code:
if (document.getElementById('TextboxSicovam').Focus)
Code:
if (document.getElementById('TextboxSicovam').onFocus == true)
Code:
if (document.getElementById('TextboxSicovam').onFocus)
Le getElementById fonctionne, je l'ai testé.
Merci d'avance pour votre aide.