focus() doesn't work inside colorbox pop-up

前端 未结 6 1718
遇见更好的自我
遇见更好的自我 2021-02-14 11:43

I tried to use focus for first input field on the form. but it doesn\'t work. When I call attr(\"id\") for that input it worked. When I call focus f

6条回答
  •  情书的邮戳
    2021-02-14 12:28

    use

    $(document).ready(function() {
           // focus on the first text input field in the first field on the page
            $("input[type='text']:first", document.forms[0]).focus();
        });
    

提交回复
热议问题