At the click of a button, I could scroll to a given location using
<button onclick="document.documentElement.scrollTop = fieldContent;" id="myBtn">Button</button>
where fieldContent is the variable containing a number for the scroll position.
However, I want to do this automatically by adding the javascript below to my back template but it not working out. I know about using the answer id but it doesn’t allow the flexibility I seek. The script below however works fine on anki (desktop). Is there a way I could work around this?
<script>
document.documentElement.scrollTop =fieldContent;
</script>