The following codes reflect the data from the map as html I want to use the information from input value How can I do this?
document.getElementById('location').innerHTML = place.formatted_address;
document.getElementById('lat').innerHTML = place.geometry.location.lat();
document.getElementById('lon').innerHTML = place.geometry.location.lng();
<ul id="geoData">
<li>Location: <span id="location"></span></li>
<li>Latitude: <span id="lat"></span></li>
<li>Longitude: <span id="lon"></span></li>
</ul>
I want to get these codes as input value but I couldn't do it my javascript knowledge is a bit bad
I tried these codes but didn't
document.getElementById('location').value = place.formatted_address;
document.getElementById('lat').value = place.geometry.location.lat();
document.getElementById('lon').value = place.geometry.location.lng();
<input type="hidden" name="adres" id="location" value="">
<input type="hidden" name="lat" id="lat" value="">
<input type="hidden" name="lon" id="lon" value="">