javascript - Dynamically inserting HTML row with jQuery not working -
i trying dynamically insert row html table jquery. below code, row appears , disappears. problem?
$(document).ready(function(){ var html = '<tr><td id="employee">joey cavazos</td><td class="satbr">6:30</td><td class="satdin">off</td><td class="sunbr">9:00</td><td class="sundin">off</td><td class="monbr">off</td><td class="mondin">off</td><td class="tuebr">off</td><td class="tuedin">4:00</td><td class="wedbr">8:00</td><td class="weddin">off</td><td class="trbr">8:00</td><td class="trdin">off</td><td class="fribr">off</td><td class="fridin">4:00</td> </tr>' $('#namesubmit').click(function(){ $('#schedbody tr').last().after(html); }); }); <form> <input type="submit" id="namesubmit" value="submit"> </form> <table id="schedbody"> </table>
$(document).ready(function () { var html = '<tr>...</tr>'; $('form').on('submit', function (e) { $('#schedbody').append(html); e.preventdefault(); }); });
Comments
Post a Comment