jquery, set focus on the first enabled input or select or textarea on the page

后端 未结 4 1588
甜味超标
甜味超标 2020-12-29 19:23

It\'s fairly straightforward. I want to set focus to the first enabled and not hidden control on the page.

For a textbox, I have

$(\"input[type=\'t         


        
4条回答
  •  青春惊慌失措
    2020-12-29 20:26

    As an extension of Jordan's answer

    $(':input:enabled:visible:not([readonly]):first').focus();
    

    This one also excludes readonly inputs

提交回复
热议问题