Tell me how to apply to all the divs that have a background-image set and change src to them. It should be like this

$('селектор div у которых background-image ').each(function () { var scr= получить src div var tarr = src.split('/'); nsrc = tarr[tarr.length - 1]; и установить уже обрезанный url )}; 

thank you in advance!

    1 answer 1

     $('div').filter(function() { return $(this).css('background-image') !== 'none'; }).attr('src', 'my-src'); 
    • Nope, does not replace with "mysrc" - zkolya
    • Do you really need to replace src? Everything works url-test - KeyGenQt
    • Blundered, confused url with src, I need to replace url - zkolya
    • Well, use not attr but these: jQuery .css () - KeyGenQt
    • Yes, it turned out, thanks! - zkolya