Page always autofocus on textarea and scrolltotop is not working then

前端 未结 2 397
滥情空心
滥情空心 2020-12-22 05:45

I have a page with some checkboxes items and then a textarea element at very bottom of the page. This textarea has no autofocus as

2条回答
  •  囚心锁ツ
    2020-12-22 06:33

    Actually I was able to hack it. Basically I made the textarea readonly on page load. so it wont get focus. And then setting it to enable again after a timeout. This way textbox will be enabled by the time user starts to scroll down.

    setTimeout(function () { document.getElementById('comments').readOnly = false }, 500);

提交回复
热议问题