javascript - Link without touch html -


i have page in old cms. allow me put img, cant put anymore.

the img have own div class="flash".

i can add script or css in header, cant touch html.... possible add link image?

thanks

you replace div link using jquery this:

var x = "http://example.com"    $(".flash").replacewith(function() {    return $("<a href='" + x + "'>" + this.innerhtml + "</a>")  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <div class="flash">    <img src="http://lorempixel.com/400/200/">  </div>


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -