Window.find not focusing on textarea

When I use window.find it is not focusing on textarea. The textarea scroll bar does not scroll when selecting with window.find. How do I focus on “Australian brother” in the textarea?

<!DOCTYPE html>
<html>
    <body>
        <textarea id="positivity" cols="50" rows="10" value="">Happiness
Love
Force
    
    
    
    
    
    
    
    
    
    
    






    
    
    Australian Brother
    Help Brother
        </textarea>
        <script>
            window.addEventListener('load', function () {
            window.find('Australian Brother');
            }, false);
        </script>
    </body>
</html>

Please use vanilla javascript, and preferably a method supported by android browsers. Thanks in advance.

Hi @manoodin, is it supposed to? According to the MDN it is non-standard anyway, and some browsers might highlight the found text (but not focus the parent element)…

you’d need some combination of indexOf and setSelectionRange.
String.prototype.indexOf() - JavaScript | MDN (mozilla.org)
HTMLInputElement.setSelectionRange() - Web APIs | MDN (mozilla.org)

Edit: Probably also a little shenanigans if you want to make it also scroll the text box. See JavaScript: Scroll to selection after using textarea.setSelectionRange in Chrome - Stack Overflow

This post was flagged by the community and is temporarily hidden.