jquery - Adding an image in place of a button in html javascript -
the problem : have "+" , "-" @ end of row add , delete rows accordingly.
instead of "-" icon, want replace trashbox.. tried replacing imgsrc. skews alignment.
even if remove box "+" , keep + alone adding row , delete trashbox "-", great.
can me out this? code below.
<tr> <td align="left"> <g:select name="standard[]" id="standard" class="statsele valid" from="${standardlist}" value="" noselection="['':'select regulatory standard...']"/> <g:select name="standard_version[]" id="standard_version" class="statsele valid" from="${standardversion}" value="" noselection="['':'select version...']" style="width:150px !important;"/> <g:select name="standard_domainnumbers[]" id="standard_domainnumbers" req="false" class="statseledomain valid" from="${['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50']}" value="" noselection="['':'select domain...']"/> <input type="checkbox" name="chk" class="delcheck"/> <input type="button" value=" + " title="add more" class="clone-faculty"/> <input type="button" value=" - " title="remove selected row" class="remove-faculty"/> </td> </tr> <script> $('.clone-faculty').click(function() { var clone = $('.add-child:first').clone(true).appendto('#itemrows'); }); $(".remove-faculty").click(function(e) { if($('.add-child').length > 1) { if($(".delcheck:checked").length != $('.add-child').length) { $(".delcheck:checked").closest("table").remove(); // $(".add-child").last().remove(); } else { alert('you cannot delete rows.'); } } }); </script>
this how did it:
<td align="left"> <g:select name="standard[]" id="standard" class="statsele valid" from="${standardlist}" value="" noselection="['':'select regulatory standard...']" /> <g:select name="standard_version[]" id="standard_version" class="statsele valid" from="${standardversion}" value="" noselection="['':'select version...']" style="width:150px !important;" /> <g:select name="standard_domainnumbers[]" id="standard_domainnumbers" req="false" class="statseledomain valid" from="${['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50']}" value="" noselection="['':'select domain...']" /> <input type="checkbox" name="chk" class="delcheck" /> <input type="button" value=" + " title="add more" class="clone-faculty" /> <img src="https://cdn2.iconfinder.com/data/icons/windows-8-metro-style/128/trash.png" style="width:17px;vertical-align: middle;" title="remove selected row" class="remove-faculty"> </td>
Comments
Post a Comment