Example using jquery and materialize.js
Once created an element with a js code, for example:
$('#buttonA').click(function() {
$('.container').empty;
$('.container').prepend('<a class="button" id="buttonB" data-id="21">Second button</a>');
}
Is created a button successfully but the problem appears when I want to code something with this generated button, for example:
$('#buttonB').click(function() {
Materialize.toast('This message is not gonna appear', 1500, 'green');
}
Nothing will happen. Anybody knows how to make it work as a normal element? I'd be so grateful :-)