- Is it possible to display all values submitted in a form with edit and delete buttons?
- Currently, only one value is being displayed at a time.
- Whenever a new value is displayed, it replaces the old one. How can this be fixed?
- You can find my code on Codepen here.
$('#localStorageTest').submit(function(e) {
e.preventDefault();
var email = $('#email').val();
var name = $('#name').val();
var message = $('#message').val();
var div = "<div><span>"+name+"</span><span >"+email+"</span><span>"+message+"</span><input type='button' value='Edit' name='editHistory'><input type='button' value='Delete' name='deleteHistory'></div>"; //add your data in span, p, input..
//alert(div);
$('.gettingValues').html(div); //apendd the div
$('#localStorageTest')[0].reset(); //clear the form
localStorage.clear();
});