This is what is in my local storage currently:
cart:"[{"Movie_Title":"I Feel Pretty","date":"Monday","time":"9:30",
"cinema_number":"3","price":"8.50","seat_number":""}, {"Movie_Title":"Breath","date":"Monday",
"time":"17:30","cinema_number":"1","price":"8.50","seat_number":""}]"
This is what I'm using to display the cart at the moment:
function displayCart(){
var jsonData = JSON.parse(localStorage.getItem('cart'));
$.each(jsonData, function(key, value){$('#cart').append(`<table id =
cart_table border= 10 ><thead><tr><th scope = "col">Movie Title</th><th scope = "col">Date</th><th scope = "col">Time</th><th scope = "col">Cinema</th><th scope = "col">Price</th><th scope = "col">Seat Number</th><th scope = "col">Remove</th></tr><td class="Movie_Title">${value.Movie_Title}</td><td class="Date">${value.date}</td><td class="Time">${value.time}</td><td
class="Cinema_number">${value.cinema_number}</td>
<td class="Price">${value.price}</td>
<td class="seat_number">${value.seat_number}</td>
<td><Button onclick = 'removeFromCart()'>Remove Item</Button>
</tr></table>`);
})
}
I am currently displaying a signle table for each item in "cart", like this:
<table id="cart_table" border="10">
<thead>
<tr>
<th scope="col">Movie Title</th>
<th scope="col">Date</th>
<th scope="col">Time</th>
<th scope="col">Cinema</th>
<th scope="col">Price</th>
<th scope="col">Seat Number</th>
<th scope = "col">Remove Item</th>
</tr>
<tr>
<td class="Movie_Title">I Feel Pretty</td>
<td class="Date">Monday</td>
<td class="Time">9:30</td>
<td class="Cinema_Number">3</td>
<td class="Price">8.50</td>
<td class="Seat_Number"></td>
<td><Button onClick = 'removeFromCart()'>Remove Item</Button></td>
</tr>
</thead>
</table>
At the moment my "removeFromCart" function does not do anything.
How can I make it remove the specific table row values from locastorage?