JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://cdn.leafletjs.com/leaflet-0.4.5/leaflet.js"></script>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4.5/leaflet.css">
<div id="map_canvas"></div>
CSS
html {
height: 100%
}
body {
height: 100%;
margin: 0;
padding 0;
}
#map_canvas {
height: 100%;
width: 100%;
position: absolute
}
JavaScript
var map = L.map('map_canvas').setView([51.505, -0.09], 13);
L.tileLayer('http://{s}.tiles.mapbox.com/v3/mapbox.mapbox-light/{z}/{x}/{y}.png', {
attribution: 'Imagery from <a href="http://mapbox.com/about/maps/">MapBox</a> — © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
maxZoom: 18,
}).addTo(map);
var marker = L.marker([51.5, -0.09]).addTo(map);
//we need a + in the script tags because of the way jsFiddle is set up;
var popup_content = 'Testing the Link: <a href="#" class="speciallink">TestLink</a>'+
'<scr'+'ipt> $(".speciallink").on("click", function(){alert("hello from inside the'
+'popup")});</scr'+'ipt>';
marker.bindPopup(popup_content);
//this could probably be shorter if included straight jQUery code, but used it from a
//source where i didn't use jquery as a dependency, and i'm to lazy to change it
map.on('popupopen', function(){
var cont = document.getElementsByClassName('leaflet-popup-content')[0];
var lst = cont.getElementsByTagName('script');
for (var i=0; i<lst.length;i++) {
eval(lst[i].innerText)
}
});