Adding the click event for dynamically created buttons

I have included the id(same for all buttons) for dynamically created buttons and then calling the click funtion based on the id 
When I click the button it should display the value of the button in the web page.

```
var elements = [];
for (i in values) {
    var timeBut= $('<div class="col-md-2 top-space-20"><input type="button" 
    id="timebutt" class="btn" value="the value fetching from the back end"> 
    </div>');
     elements.push(timeButt);

<script>
$("document").ready(function () {
$("#timeButt").click(function (){
     msg1 = "The free time slot is" + ("#value")
});
})
$("#resultDiv1").html(msg1);
</script>

```