JSFiddle - React, Tailwind, and code Playground

HTML

<div id="modal">
  <div class="btn1">А</div>
  <div class="btn2">Б</div>
  <div class="btn3">В</div>http://jsfiddle.net/venzell/58d73/5/#
  <div class="btn4">++</div>
</div>

CSS

div[class^=btn] {
  background-color: #fefafe;
  border: 1px solid #efafef;
  float: left;
  margin-right: 2px;
  height: 50px;
  width: 50px;
}

JavaScript

var func_list = [
  function(el) {
    alert($(el).text() + ' 1');
  },
  function(el) {
    alert($(el).text() + ' 2');
  },
  function(el) {
    alert($(el).text() + ' 3');
  },
  function(el) {
    var n = $('div[class^=btn]').length + 1,
      btn = '<div class="btn' + n + '">new ' + n + '</div>';
    $('#modal').append(btn);
  },
  function(el) {
    alert('Hi there');
  }
];

func_list.forEach(function(func, i) {
  var selector = 'div:nth-of-type(' + (i + 1) + ')';
  $('#modal').on('click', selector, function() {
    func(this);
  });
});