Leaflet.EasyButton on GitHub.

L.easyButton is run effectively with just the first two parameteres:

L.easyButton(<String> Font Awesome CSS Class,
<function> to be called onClick,
<string> mouseover text,
<map object> defaults to variable map)

Without any parameters

  1. The icon will default to an empty circle
  2. The click function will alert 'no function selected'
  3. Mouseover text will be an empty string
  4. The new button will be added to whatever is stored in variable map

This Leaflet plug-in uses Font Awesome; make sure both are included! Links to the CDNs are at the bottom of the page

L.easyButton must be included after:

<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.1/leaflet.css" /> <script src="http://cdn.leafletjs.com/leaflet-0.7.1/leaflet.js?2"></script>