jQuery .focus doesn’t actually focus a newly created element

后端 未结 8 1905
清歌不尽
清歌不尽 2020-12-08 03:38

Let’s say I have this markup:

First paragraph

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-08 03:56

    This code will avoid dependencies on other plugins and allow you to have it on any element.

    $('html, body').animate({ scrollTop: $("#newP").offset().top }, 500);
    

提交回复
热议问题