Add or remove by clicking points on the map Yandex?

Good afternoon, there is such structure
<div id="button">click-me</div>

<div class="all-adress">
 <div class="address">
 <div class="address">
 <div class="address">
 <div class="address">
 <div class="address">

On button click I get all the divas into a variable with the address class.
How to add them to the map.
Walk cycle, and pull out of each point Longitude and latitude is know how, the only question is, what funtion Yandex map add to map + with its own icon?
And is there an analogue to remove them?
April 3rd 20 at 17:24
1 answer
April 3rd 20 at 17:26

as you noticed first, create a label object, then adds it
//Global context
var myMap,myPlacemark;
// context map
myMap = new ymaps.Map(...);
//context clicking 1
myPlacemark = new ymaps.Placemark([lat, lon],{...});
//the context of pressing 2

to execute code at an arbitrary time in an arbitrary context variable myMap should be globally accessible. But if the deletion occurs from an arbitrary context and myPlacemark should be available globally.
Thank you, I needed the add and remove methods, everything works fine) - Lilian.Stroman commented on April 3rd 20 at 17:29

Find more questions by tags Yandex.Maps