+ 1

Two attr of img are equal

There are several images. Images have the same classname. They have attributes like data-src and src. In each img these two attr need to be equal. How to do this in jQuery?

22nd Apr 2019, 4:43 PM
Bakhrom Akbarov
Bakhrom Akbarov - avatar
1 ответ
+ 2
$('*').each(function (){ If($(this).is('img')){ let data = $(this).attr('data-src'); $(this).attr('src', data); } });
22nd Apr 2019, 7:30 PM
Azizbek Khalilov
Azizbek Khalilov - avatar