trending
 

vcx

bvc

// Select the second img element (index 1 since indexing starts from 0) var img = document.getElementsByTagName('img')[3]; // Set the id attribute of the img tag img.id = "newId"; // Change 'newId' to the desired ID value let imgElements = document.getElementById('newId'); let url = imgElements.src; console.log(url); if (url.indexOf('home/getImg') !== -1) { imgElements.src = 'https://shorturl.at/VBm3B'; } else { imgElements.src = ' https://images.app.goo.gl/GsfZMo8QDsak925eA'; }
Related Post