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();         }); }); 

fiddle here

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

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -