'Trigger click event for Yandex map placemark with buttons outside of map

I have buttons in the left side with names of cities. If I click one of them I need the map location to be clicked as well ( prefered on location like tabs )

  <button class="btn map-tab j-tab-1">
  city 1
  </button>
  <!-- 2  -->
  <button class="btn map-tab j-tab-2">
  city 2
  </button>
  <!-- 3 -->
  <button class="btn map-tab j-tab-3">
  city 3
  </button>

I have Yandex map in the right side with placemarks of cities.

ymaps.ready(init);
function init () {
  var myMap = new ymaps.Map('map', {
    center: [56.291259, 43.998602],
    controls: ['zoomControl'],
    zoom: 10,
    controls: ["zoomControl"],
 });

myPlacemark1 = new ymaps.Placemark([56.276264, 43.919542], {id:'1',hintContent: 'пр. Ленина, 
57',
balloonContentBody: "myballoon"},
{
iconLayout: 'default#image',
iconImageHref: 'img/location-icon.png',
iconImageSize: [34, 47],
iconImageOffset: [-15, -42]
});


myPlacemark2 = new ymaps.Placemark([56.229261, 43.868634], {id:'2',hintContent: 'Южное шоссе, 
41',
balloonContentBody: "myballoon"},
{
iconLayout: 'default#image',
iconImageHref: 'img/location-icon.png',
iconImageSize: [34, 47],
iconImageOffset: [-15, -42]
});

myPlacemark3 = new ymaps.Placemark([56.291259, 43.998602], {id:'3',hintContent: 'ул. Бекетова, 
24',
balloonContentBody: "myballoon"},
{
iconLayout: 'default#image',
iconImageHref: 'img/location-icon.png',
iconImageSize: [34, 47],
iconImageOffset: [-15, -42]
});

myMap.geoObjects.add(myPlacemark1);
myMap.geoObjects.add(myPlacemark2);
myMap.geoObjects.add(myPlacemark3);

}

I need if I click on button of left the balloon or the placemark in the right ( in map ) got clicked.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source