javascript - Table [Row] cannot be deleted using jquery -
I'm having trouble deleting table row by using the button.
Live:
HTML:
& lt; Select class = "Cambodia Form-Control" & gt; & Lt; Option value = "" selected = "selected" & gt; Choose a person & lt; / Options & gt; & Lt; Options & gt; Bob & lt; / Options & gt; & Lt; Options & gt; Kelly & lt; / Options & gt; & Lt; / Select & gt; & Lt; Br> & Lt ;! - Table - & gt; & Lt; Table class = "table" & gt; & Lt; Thead & gt; & Lt; Div class = "container" & gt; & Lt; TR & gt; & Lt; Th & gt; First Last Name & lt; / Th & gt; & Lt; / TR & gt; & Lt; / Div & gt; & Lt; / Thead & gt; & Lt; / Table & gt;
JS / Jquery:
$ ('.combobox'). Change (function (e) {var selectedVal = $ (this) .val (adend ('& lt; tr & gt; & lt; td & gt;' + selectedVal + '& lt; / td & gt; & lt; TD & gt; IMG class = "Delete" src = "Picture / Remove Png" width = "25" height = "25" /> gt; & lt; / td & gt; & lt; / tr & gt; ; ');}); $ (' Table td img.delete ') Click (function () {$ (this) .Parent (). Remove ();});
< / Pre>Any help would be great if I'm using Bootstrap!
to delete The image handler for the image must be added to each new row in the table.
$ ('combobox'). Change (function (e) {var selectedVal = $ (this) .val (); $ ('table') .endend ('<' tr & gt; & lt; td & Gt; '+ selectedVal +' & lt; / td> & lt; td & gt; & lt; img class = "Delete" src = "Picture / Remove" "Width =" 25 "height =" 25 " /> Gt; & lt; / td & gt; & lt; / tr & gt; '); $ (' Table TD img.delete '). Click (function () {$ (this). Parent (). Parent (). Remove ();});});
Comments
Post a Comment