Closest Previous Sibling

Get the closest sibling to the target <textarea> without using id's or classes or attributes on the textarea and spans elements.

HTML

<div>
    <span>1</span>
    <textarea></textarea>
    
    <span>2</span>
    <textarea></textarea>
    
    <span>3</span>
    <textarea></textarea>
</div>

JavaScript

$('div').on('keydown', 'textarea', function () {
    
        $(this).closest($('span').text($(this).val()))

})