I’m using jQuery with the power of localStorage.
Here is what I have:
<textarea name="localStorageString" id="localStorageString"></textarea>
<script>
var userJson = localStorage.getItem('userJson');
$('#localStorageString').html(userJson);
$('#localStorageString').keyup(function(){
alert($(this).html());
});
The textarea is correctly filled, the problem is when I modify it, it always alerts the same value (set by html(userJson)).
Any idea ?
html()– it’s the native JavaScript.innerHTMLfunction. It takes everything (all the nodes) inside the tag as a string.val()– that’sform.element.value.