javascript - Jquery remove function not working on Mustache Template -
i trying implement form using mustache , jquery, have add button keeps adding new form , delete deletes respective form. html of form done using mustache , every form has delete button, want remove delete icon/button first form.
i tried deleting using jquery not worked, not sure wrong doing...
$(document).ready(function () { var output = $("#output"); var template = $("#test1").html(); // var rendered = mustache.render(template, {name: "luke"}); var customtemplate = mustache.render(template, {bikename: "abcd"}); $(customtemplate).find('.delete').hide(); output.append($(customtemplate)); $('#addepod').on('click', function(){ customtemplate = mustache.render(template, {bikename: "new bike"}); output.append(customtemplate); }); $('#output').on('click','#deletepod',function() { $(this).parent().remove(); }); });
i tried
output.find('.delete').remove();
it worked me!!
still not sure why cannot remove element mustache template, if of know please let me know.
Comments
Post a Comment