add marker with Google-Maps-for-Rails
I was playing with https://github.com/apneadiving/Google-Maps-for-Rails and i'd like to clear all the marker on a map and add a new one at the position clicked by the user on the map, I added the following code in my page <script type="text/javascript" charset="utf-8"> function gmaps4rails_callback() { google.maps.event.addListener(Gmaps4Rails.map, 'click', function(object){ alert(object.latLng); }); </script> And in this way i can see an alert with the lat and long value, now how can i delete the old markers and create a new marker and place it on the map? If you want to clear markers created