What should the data-title attribute look like so that the title of the article is not the title of the page?

Closed due to the fact that the essence of the question is not clear to the participants 0xdb , AivanF. , slippyk , Kostiantyn Okhotnyk , Air 27 Apr '18 at 12:07 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    Attribute "data" does not have a standard value, it will contain what it puts: heading, meaning heading; the title of the article and, therefore, the title of the article. Without code, your question can not be answered. - Dmytryk
  • Well, I need to know what to put in it to display the title of the article. Now I have the title of the page - Alexander
  • put the title of the article - Dmytryk
  • so I do not need the title of the page! It is different from the title of the article. I don't know how to put it, that's why I ask - Alexander
  • Calm and only calm: I noticed the error and corrected myself - Dmytryk

1 answer 1

Hmm ....
Then this solution will suit you. We form a sharing insertion through jQuery

(function($){ var newstitle = $('.f_post_text').text(), share = $('<div></div>', { class: "ya-share2" }).attr({ 'data-services': "vkontakte,facebook,odnoklassniki,viber,whatsapp,skype,telegram", 'data-title': encodeURIComponent(newstitle) }), script = $('<script></script>', { src: "ваш_share_скрипт.js" }); $("body").append(share, script); $(document).on('click', '#share42 a', function(e){ /** * Обрабатываем клик */ }); }(jQuery));