Is it possible to focus on a using JavaScript focus() function?

Is it possible to focus on a <div> using JavaScript focus() function?

I have a <div> tag

<div id="tries">You have 3 tries left</div>

I am trying to focus on the above <div> using :

document.getElementById('tries').focus();

But it doesn’t work. Could someone suggest something….?

8 Answers
8

Leave a Comment