Answers for "how to change the img src based on the attribute"

3

set img src using javascript

document.getElementById("imageid").src="../template/save.png";
Posted by: Guest on May-19-2020
1

change img src css

// You cannot do it with CSS alone
// You can with JS

element.style.src = "someImage.jpg";

// Or with jQuery
$('some-element').attr('src', 'someImage.jpg');
Posted by: Guest on April-03-2020

Code answers related to "how to change the img src based on the attribute"

Code answers related to "Javascript"

Browse Popular Code Answers by Language