SO - 31259865

by Arun P Johny

HTML

<script src="http://tjcrowder.github.io/simple-snippets-console/snippet.js"></script>
<textarea name="textbox" cols="50" rows="5">say it...</textarea>
<br>
<input type="submit" onclick="addTextArea();" />

JavaScript

function appendToStorage(name, data) {
    var old = localStorage.getItem(name);
    if (old === null) old = '';
    localStorage.setItem(name, old + data);

    //to display the value for debugging
    snippet.log(localStorage.getItem(name))
}
addTextArea();

function addTextArea() {
    appendToStorage('oldData', $('textarea[name="textbox"]').val()); //use .val() to get the value, also need to use attribute selecotr for name
}