I have this div that I am fetching from a database
'<div class="column">'+
'<div>'+ '<img src='+aparat.imagine+' width="150" height="140" />' +'</div>'+
'<div>'+ aparat.nume + '</div>' + //functia care le aranjeaza
'<div id="pret">'+ aparat.pret +' lei' + '</div>'+
'<div>'+'<button data-value="'+aparat.id+'" class = "comanda">'+'Comanda!'+'</button>'+'</div>'
+ '</div>';
and the event handler:
$(document).ready(function(){
$('.comanda').click( function() {
alert('button clicked');
});
});
The problem is, when I click the button nothing happens, what am I doing wrong?