JSFiddle - React, Tailwind, and code Playground
by m72m72
HTML
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>Page Title</title>
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<!-- Make sure you put this AFTER Leaflet's CSS -->
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
</head>
<body>
<a href="#" class="gps_btn">--------------KLIK-----------------</a>
<div id="map2"></div>
<script>
var geo_s=52.5185;
var geo_d=18.3183;
var map2 = L.map('map2').setView([geo_s, geo_d], 15);
L.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', {attribution: '© <a href="https://osm.org/copyright">OpenStreetMap</a> contributors' }).addTo(map2);
$( document ).on( "click", ".gps_btn", function () {
$('#map2').height( $(document).height());
setTimeout(function () { map2.invalidateSize() }, 500);
console.log(typeof tujestes);
if(typeof tujestes!=='undefined'){
console.log("czemu tu nie wchodzi do pętli?");
map2.removeLayer(tujestes);
}
var tujestes=L.marker([geo_s,geo_d]);
tujestes.addTo(map2);
});
</script>
</body>
<html>