javascript - 将模态值传递给 GeoJSON
问题描述
一旦用户点击 X,我正在尝试将值从模式传递到 GeoJason 属性你介意推荐我或帮助我修复代码吗
模态代码是
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<span class="close">×</span>
<input type="text" id="myText" value="Some text...">
</div>
</div>
地图点击功能是
function onMapClick(e) {
modal.style.display = "block";
var geojsonFeature = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [e.latlng.lat, e.latlng.lng]
}
}
var marker;
L.geoJson(geojsonFeature, {
pointToLayer: function(feature, latlng){
marker = L.marker(e.latlng, {
title: "Resource Location",
alt: "Resource Location",
riseOnHover: true,
draggable: true,
}).bindPopup("<input type='button' value='Delete this marker' class='marker-delete-button'/>");
marker.on("popupopen", onPopupOpen);
return marker;
}
}).addTo(map);
}
关闭模态功能代码是
span.onclick = function() {
modal.style.display = "none";
}
解决方案
推荐阅读
- database-design - 如何使关系在密码中分割足球比分
- python - 如何在 python 中从 KafkaConsumer.poll() 获取 ConsumerRecord
- java - Apache Commons MultiMap 已弃用,我现在应该使用什么?
- reactjs - react 无法从 api 获取数据
- blockchain - 源文件需要不同的编译器版本:Truffle
- ios - UITableView 覆盖
- swift - 如何删除导航栏模糊效果 - swift
- html - 表格单元格与子输入相同的宽度(键入文本)
- python - 如何将变量传递给 pyspark 中的 spark.sql 查询?
- javascript - 如何告诉 js 等待完成所有 fetch 命令然后继续执行全局代码?