I'm able to pass the displayMessage variable, but the page reloads. I've been looking at ajax tutorials, but I'm not sure how to pass displayMessage without the page reloading.
I want to store more than one message on the phone. So if I send "help me stackoverflow," then "please," they both get stored. (right now "please" would replace "help me...").
// this is my form <form role="form"> <div class="form-group"> <textarea class="form-control" id="message" rows="3"></textarea> </div> <button type="submit" id="submit" class="btn btn-default">Submit</button> </form> // this is where message displays <span class="displayMessage"></span> // this is my js $(document).ready(function () { $('#submit').click(function () { var displayMessage = $('#message').val(); localStorage.displayMessage = displayMessage; }); }); $(document).ready(function () { $('.displayMessage').html(localStorage.displayMessage); })
