1// get the text
2var text = $('#test').text();
3
4// set the item in localStorage
5localStorage.setItem('test', text);
6
7// bind text to 'blur' event for div
8$('#test').on('blur', function() {
9
10 // check the new text
11 var newText = $(this).text();
12
13 // overwrite the old text
14 localStorage.setItem('test', newText);
15
16 // test if it works
17 alert(localStorage.getItem('test'));
18
19});
20