Inside a large (even unlimited) number of tabs there is a map, initialize:

ymaps.ready(function(){ $('.tab-item').click(function(){ var myMap; initYaMap(); myMap = new ymaps.Map(document.getElementsByClassName('tracking-map__yandex-map'), { center: [53.35, 83.73], zoom: 4 }); }); }); function initYaMap () { } 

id cannot be used. I suppose that instead of a string, you must pass the found element according to the principle $('.classname')[0]

But nothing comes out. Can anyone come across? Is there a solution to this issue, I am familiar with the API, I don’t need references to it, I strive to solve the problem, I don’t ask someone to google it instead.

  • So in API it is written in Russian that you can pass an HTML element. document.getElementsByClassName('tracking-map__yandex-map') returns the collection, you must take some element from it - Alexey Ten
  • @AlexeyTen cycle to sort out in general - Jarvis
  • @AlexeyTen identify this item for what? - Jarvis
  • These are your items. You better know how to identify them - Alexey Ten
  • Show the "skeleton" of your html. As I understand you have something of type body (.tab-item + (.tab-content .tracking-map__yandex-map) . For example, there is a tab (tab), its title has a class tab-item , when you click on it, the content of the tab is shown (let's say it has a tab-content class) and in the content there is one map with the class tracking-map__yandex-map . Looks like I have imagined? - tutankhamun

0