I am trying to generate divs with Javascript dynamically. What I mean: in the first div there will be a button with a .click event and when it will be clicked I want a new div to be generated. Inside the new div there must be another button with a .click event which will act as the first one. My problem is that in the div that is generated that button does not create a new div.
This is my js function:
$(function() {
        $('#openFirstTab').click(function(){
            var newDiv = $('<div class="col s4 bordered"><h5 class="header col s12 light">A modern responsive front-end framework based on Material Design</h5><button id="openSecondTab">Add Div</button></div>');
          $('.row').append(newDiv);
        });
        $('#openSecondTab').click(function(){
            var newDiv = $('<div class="col s5 bordered"><h5 class="header col s12 light">A modern responsive front-end framework based on Material Design</h5><button id="openSecondTab">Add Div</button></div>');
          $('.row').append(newDiv);
        });
    });
and the HTML:
<div class="custom_container-full-width">
    <div class="row">
      <h1 class="header center orange-text">Starter Template</h1>
        
      <div class="col s3 bordered">  
        <h5 class="header col s12 light">A modern responsive front-end 
             framework based on Material Design</h5>
        <button id="openFirstTab">Add Div</button>
      </div>
    </div>  
  </div>
 
    