Question
IT
JP
Last activity: 18 Nov 2024 12:07 EST
Scrolling down the Text area to enable the checkbox sometimes fails for mobile devices
Hi everyone,
I have set up a checkbox that will enable itself when a text area is fully scrolled, and it works fine for PC but I couldn't get it to work 100% of the time on mobile. Sometimes I need to scroll down a couple more times, sometimes I need to click on the text area first then scroll down, I don't really know what causes this issue. Here's the javascript I used if anyone can help me take a look at it, thank you.
Hi everyone,
I have set up a checkbox that will enable itself when a text area is fully scrolled, and it works fine for PC but I couldn't get it to work 100% of the time on mobile. Sometimes I need to scroll down a couple more times, sometimes I need to click on the text area first then scroll down, I don't really know what causes this issue. Here's the javascript I used if anyone can help me take a look at it, thank you.
function checkScrollEnd(cls){ var textarea = document.querySelector('.' + cls + ' > span > span > textarea:first-of-type'); if(textarea) { textarea.addEventListener('scroll',setFlg.bind(this)); } textarea.readOnly = "true" function setFlg() { var scrollHeight = textarea.scrollHeight; var scrollTop = textarea.scrollTop; var clientHeight = textarea.clientHeight; if (scrollHeight - scrollTop < clientHeight + 2) { if (cls == "ScrollCheck") { var elementInd = document.querySelector('input[type="checkbox"][name="checkboxenable"]'); if (elementInd) { elementInd.removeAttribute('disabled'); } } } }
***Edited by Moderator Marije to change type from General to Product, added Product details and Capability tags****