Write delete function and add javascript