// get the text var text = $('#test').text(); // set the item in localStorage localStorage.setItem('test', text); // alert the value to check if we got it alert(localStorage.getItem('test'));