Good day.

I insert into the page code, copying from the API:

<script src="https://yastatic.net/share2/share.js"></script> <script> var share = Ya.share2('my-share', { content: { url: 'https://yandex.com' } // здесь вы можете указать и другие параметры }); </script> 
 <div id="my-share"></div> 

But, the buttons are not initialized. Please tell me what is wrong?

  • see errors in browser console - Grundy

1 answer 1

Everything turned out to be quite simple. Initialization script to run after the formation of the div.

 var share = Ya.share2('my-share', { content: { url: 'https://yandex.com' } // здесь вы можете указать и другие параметры }); 
 <script src="https://yastatic.net/share2/share.js"></script> <div id="my-share"></div> 

  • Please mark the answer as accepted. - Roman Paradeev