Guru Guru - 5 months ago 9x
Javascript Question

Jquery set attribute to every element

I want to set attribute of every a tag as img tag's src.

Here is what I did.


But every a tag has same href.

How can I fix this


You should go throught all the images and asign it one by one (That's using your own code). You can do something like:

$(document).ready(function() {
  $(".single img").each(function() {
       var href=$(this).attr('src');

          helpers: {
              title : {
                  type : 'float'