W
W
WiKiTik2018-03-14 17:52:44
JavaScript
WiKiTik, 2018-03-14 17:52:44

How to show alt images as text in VK?

There is a need to view emoji emoticon codes in VKontakte posts. For example, here is a post:
vk.com/wall-124855981_31288
In the page code, the codes we need are written in the Alt attributes. Run the script via Tampermonkey:

$('img').each(function () {
  $(this).replaceWith($('<span>').html($(this).attr('alt')));
});

Unfortunately it doesn't work. Can you tell me what needs to be changed in the script so that alt-"text" is shown instead of the image?
PS In javascript/jquery I am a complete zero)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
twobomb, 2018-03-14
@twobomb

$('img').each(function () {
  $(this).replaceWith('<span>'+$(this).attr('alt')+'</span>');
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question