As Peter mentioned in the comments, for an
<input>
you need to set the
.value
, not the
.innerText
.
Since you're using jQuery, you won't be able to set the property directly on the jQuery object. You can use jQuery's
val
method instead:
$("#txtPlaceId").val(localStorage.getItem("Map_PlaceId"));
$("#txtPlaceName").val(localStorage.getItem("Map_PlaceName"));
$("#txtPlaceAddress").val(localStorage.getItem("Map_PlaceVicinity"));
alert("Storage: " + localStorage.getItem("Map_PlaceId") + "\n" +
"Textbox: " + $("#txtPlaceId").val());
.val() | jQuery API Documentation[
^]
In this case, it would be simple enough to use raw Javascript instead of jQuery:
document.getElementById("txtPlaceId").value = localStorage.getItem("Map_PlaceId");
document.getElementById("txtPlaceName").value = localStorage.getItem("Map_PlaceName");
document.getElementById("txtPlaceAddress").value = localStorage.getItem("Map_PlaceVicinity");
alert("Storage: " + localStorage.getItem("Map_PlaceId") + "\n" +
"Textbox: " + document.getElementById("txtPlaceId").value);