I have written a script in Javascript using JQuery in which when I click on a button something happens (e.g. alert("hello").
What I am trying to do now is when I click again on the same button to run a different function.
This is what I have now:
$(document).ready(function(){
$(".imgMarker").click(function() {
var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0)));
});
});
I have read that I can use the toggle() method but I can not make it work.