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

前端 未结 8 1752
说谎
说谎 2020-11-22 14:21

Is it possible to focus on a

using JavaScript focus() function?

I have a

tag

8条回答
  •  余生分开走
    2020-11-22 14:48

    To make the border flash you can do this:

    function focusTries() {
        document.getElementById('tries').style.border = 'solid 1px #ff0000;'
        setTimeout ( clearBorder(), 1000 );
    }
    
    function clearBorder() {
        document.getElementById('tries').style.border = '';
    }
    

    This will make the border solid red for 1 second then remove it again.

提交回复
热议问题