Customer Data jQuery Cognizant Handson Program

Create a web page that contains two text boxes to get the name and email address of the customers. When you click the ‘Add Customer Details ‘button, the entered data get appended to the table below that and when you click the ‘Delete Customer Details’ button, the selected row/rows in the table (using check box) should get deleted dynamically using jQuery. 

Hint: You can use the jQuery .append() method to append or add rows inside a HTML table. Similarly, you can use the .remove() method to remove or delete table rows as well as all everything inside it from the DOM dynamically with jQuery

customer.js

//WRITE YOUR jQUERY CODE HERE
$(".add-row").click(function(){
    var name=$('#name').val();
    var tr="<tr><td><input type='checkbox' name='record'></td><td>"+name+"</td></tr>";
    $("#frm table tbody").append(tr);
});

$(".delete-row").click(function(){
    $('tr input:checked').remove();
});

Similar Posts