Answers for "document.getelementsbyclassname("preview").innerhtml=src;"

0

document.getElementByClassName("preview").innerHTML=src;

function update(previewPic){
/* In this function I should 
    1) change the URL for the background image of the div with the id = "image" 
    to the source file of the preview image

    2) Change the text of the div with the id = "image" 
    to the alt text of the preview image 
    */
   document.getElementById("image").setAttribute('style', 'background-image: url(' +  previewPic.getAttribute("src") + ')');
   document.getElementById("image").innerHTML = previewPic.getAttribute("alt");
}


function undo(){
    document.getElementById("image").style.backgroundImage = "";
    document.getElementById("image").title = "";
}
Posted by: Guest on May-29-2020

Code answers related to "document.getelementsbyclassname("preview").innerhtml=src;"

Browse Popular Code Answers by Language