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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -