javascript - Show new line instead of \n -
i experimenting html5's new localstorage , far have been in capturing content (text) inputted onto form , storing in localstorage.
my problem starts when person comes page, want localstorage values loaded correct input on form.
i doing success, users see following:
but them see text without double quotes , new lines characters, them see:
hi
how you
just inputted originally. how can achieve this? appreciated.
to set value of text area, using following:
$(document).ready(function() { alltextareasonpage.each(function(index, entry) { var idoftextarea = $(this).attr('id'); if (pagelocalstorage.get(idoftextarea)) { $(this).val(pagelocalstorage.get(idoftextarea)); } }); });
looks me string being stored json...
$(this).val(json.parse(pagelocalstorage.get(idoftextarea)));
should solve it, should cause...
Comments
Post a Comment