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

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -