JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css">
<div id="map"></div>
CSS
#map { height: 500px; }
JavaScript
var map = L.map('map').setView([46.95, 7.45], 15);
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18
}).addTo(map);
var marker = new L.Marker(
[46.947, 7.4448],
{
title: 'marker',
name: 'some name'
}
).on('click', markerOnClick).addTo(map);
function markerOnClick(e)
{
alert("hi. you clicked the marker at " + e.latlng);
alert("title of marker: " + this.options.title);
alert("name: " + this.options.name);
}