javascript - innerHTML 输入值
问题描述
以下代码将地图中的数据反映为 html 我想使用输入值中的信息 我该怎么做?
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>
我想将这些代码作为输入值,但我做不到我的 javascript 知识有点糟糕
我尝试了这些代码,但没有
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="">
解决方案
推荐阅读
- android - MUC configuration error : Couldn't find a field for the specified variable
- c# - App delay in launching the splashscreen in xamarin forms Android how to optimize the startup time
- javascript - XML HTTP 请求 - 处理连接丢失
- javascript - Angular 6 调用 localhost API
- dart - Exception while building a Flutter application
- jestjs - 在 test.each Jest 中使用变量表达式
- netsuite - 有没有办法通过 SOAP 通过外部 id 列表搜索 NetSuite 分类记录?
- testing - angular 6测试脚本中的listenglobal渲染器事件触发
- javascript - 在 Jest 中模拟需要函数
- javascript - AJAX 停止传播下一个调用