I'm using the following code trying to append a new row to jquery but it's not working.
$('#search-results > tbody').append('<tr><td data-th="Name">Test</td><td data-th="Email">[email protected]</td><td data-th="Phone Number">07777777777</td><td data-th="Car Reg.">ocf83or</td><td data-th="Time">1pm</td></tr>'); My table is setup like so:
<table class="view-bookings-table mobile-optimised hidden" id="search-results"> <thead> <tr> <th scope="col">Name</th> <th scope="col">Email</th> <th scope="col">Phone Number</th> <th scope="col">Car Reg.</th> <th scope="col">Time</th> </tr> </thead> <tbody></tbody> </table> EDIT
My full code is actually:
$('#search').submit(function(event) { event.preventDefault(); $('#search-results > tbody').append('<tr><td data-th="Name">Test</td><td data-th="Email">[email protected]</td><td data-th="Phone Number">07777777777</td><td data-th="Car Reg.">ocf83or</td><td data-th="Time">1pm</td></tr>'); });