javascript - store image src in a js variable so that it can be used to display background image -
how store image src of above image tag in javascript variable?
<img class="preview" alt="styling bandana" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/389177/bacon.jpg" onmouseover="update(this)" onmouseout="undo()">
i need url can enter in here
document.getelementbyid("image").style.backgroundimage = "url(' + imgsrc + ')";
and background image
jquery = .attr('src'); js = .getattribute('src');
Comments
Post a Comment