I have problem with dynamic generated buton from typeahead twitter:
templates: {
empty: [
"<button type='button' class='btn btn-danger btn-sm form-add' data-toggle='modal' data-target='#form-add' data-title='Add' data-text='abc' data-form-action='' data-parent-id=" + $(self).data("parent-id") + ">Add</button>"
].join("\n"),
suggestion: function(data) {
return "<p>" + data.name + "</p>";
}}
and I would like send data-parent-id
to my modal on click event on button Add and this not work.
$("button.form-add").on("click", function(e) {
console.log("typeahead"); });
What is wrong ?
Regards