Insert 'variable' into the SRC of the image

-1

How do I do this?

I need a "Variable" to stay in the SRC of the img tag, and it pulls the images.

$JQuery('<div class="bannersucesso" style=" text-align: center;"><img src="#"></div>').insertBefore('.header-container');

In that src="#" there, you need to do this:

{{widget type="banner/widget_banner" template="banner/banner.phtml" banner="confimacao"}}

But it does not pull the image. How can I resolve this?

    
asked by anonymous 09.03.2017 / 15:04

1 answer

-1

Try this

First you must give an ID for your IMG tag.

Example:

Code:

<img src="" id="minhaImagem">

Now within your javascript code you can dynamically change the SRC attribute.

Code:

<script> 
document.getElementById("minhaImagem").src = [URL_DA_IMAGEM] 
</script> 

Replace [IMAGE_URL_ URL] with the variable with the image path.

    
09.03.2017 / 16:21