Javascript syntax to add a loop variable inside another variable

I am looking to incorporate the following id variables: e1, e2, etc. into a loop.

What is the right syntax to handle the ‘#e’+i and ‘#e’+i elements, to avoid writing multiple functions eg. : $(document).on('change', '#e1', function() { and var exp = 'e1';

PS: Currently, the below on change function is not triggered.

for (var i = 0; i < 10; i++) {      
        
$(document).ready(function() {          
              $(document).on('change', '#e'+i, function() {
                if ($("#e"+i).is(":checked")) {     var chk = $('#e'+i).val(); var exp = 'e'+i; }
                else {  chk = 0 ;   var exp = 'e'+i;    }
                $.ajax({
                        url: "modify.php",
                        method: "POST",
                        data: {check: chk, experience: exp },
                  });
              });       
            })
            ;
        }