javascript - getting Uncaught SyntaxError: Unexpected token } while trying to remove table row dynamically -
i have looked same problem in other threads not find solution.
trying clone table row , append same table changing index of input field , removing add glyph-icon , replacing new glyph-icon has onclick
function , when try remove row on click of glyph-icon getting this(uncaught syntaxerror: unexpected token }) error. checked code again , again not find solution.
here code
$(document).ready(function(){ var glyphremove=""; glyphremove="<span class='glyphicon glyphicon-minus glyph_size' id='remove' onclick='$(this).closest('tr').remove()' aria-hidden='true'></span>"; $("#add").click(function() { var clone= $("#cloneobject").clone(); clone.removeclass('hide'); clone.prop('disabled',false); clone.find('#add').remove(); clone.find('#glyph').append(glyphremove); clone.appendto("#shiftstable"); }); });
how ever when change onclick
function onclick=$this.parent().parent().remove()
, works fine , remove td
section containing glyph-icon.
getting wrong.
here:
glyphremove="<span class='glyphicon glyphicon-minus glyph_size' id='remove' onclick='$(this).closest('tr').remove()' aria-hidden='true'></span>"; $("#add").click(function() { var clone= $("#cloneobject").clone(); clone.removeclass('hide'); clone.prop('disabled',false); clone.find('#add').remove(); clone.find('#glyph').append(glyphremove); clone.appendto("#shiftstable"); } ^ });
remove it.
Comments
Post a Comment