How to create multiple ace.edit for multiple textarea on the same page

I’m using ace on my web and i use js code to find all textarea which use css ace_readonly_php and i found 2 textarea then i iterate and add it in ace but only works the first one the other one doesn’t work

My js code:

if ($('.ace_readonly_php').length) {
$(function() {
  var elel = document.getElementsByClassName('ace_readonly_php');
  console.log("Found "+elel.length+" Element");
  for(let i=0;i<elel.length;i++){
  var editor = ace.edit(elel[i]);
  editor.setTheme("ace/theme/monokai");
  editor.getSession().setMode("ace/mode/php");
  editor.setReadOnly(true);
}
});
}