So i'm dynamically creating $('#previousto1') element from another button click. Strange thing is that when im creating the button i can see it in the DOM with id 'previousto1' but .on('click'... does not seem to trigger anything inside it.
I'm using handlebars.js and what im doing is on buttno click im rewriting all the content inside a div. So the new button $('#previousto1') doesn't exist when the page loads
$('#previousto1').on('click', function() {
console.log(1);
var theTemplateScript1 = $("#address-template1").html();
var theTemplate1 = Handlebars.compile(theTemplateScript1);
var theCompiledHtml1 = theTemplate1(context);
$('.content-placeholder').html(theCompiledHtml1);
});
