How to wrap click function in jquery? : I just started to learn js and need a little help: I have the following function: 

    window.onload = function call() {
    
      function greatFunction(elem) { 
    
    //do stuff
    }    
             var textEditor1 = $('#cl1').find('textarea');                  
            textEditor1.on('focus change mousedown mouseout keyup mouseup', function () {
                greatFunction(this)
            });  
            
            var textEditor2 = $('#cl2').find('textarea');                     
            textEditor2.on('focus change mousedown mouseout keyup mouseup', function () {
                greatFunction(this)
            });         
            
            var textEditor3 = $('#cl3').find('textarea');                    
            textEditor3.on('focus change mousedown mouseout keyup mouseup', function () {
                greatFunction(this)
            });      
    }


HTML:

    <div id="cl1" class="cl active"><textarea id="chatTextarea" class="chatTextarea"></textarea></div>
    <div id="cl2" class="cl"><textarea id="chatTextarea" class="chatTextarea"></textarea></div>
    <div id="cl3" class="cl"><textarea id="chatTextarea" class="chatTextarea"></textarea></div>

My target is to wrap all three eventListener into one, but all I tried went wrong... Can  anyone help? #Dontrepeatyourself #DRY