I'm unable to make this code work property. Focus is on style, because everything else is working just fine.
for (var i = 0; i < apartments.length; i++) {
 apartments[i].click(function(e){
  var popupWrap = document.getElementById('front-view');
  var popup = popupWrap.appendChild(document.createElement('div'));
  var el = document.getElementsByClassName('popup');
  popup.className = 'popup';
  popup.innerHTML = "<h4>" + this.data("id") + "</h4>";
  el.style.color = 'red';
 });
}
In console it show me this message
el.styleis undefined
 
    