JQuery: use "name" as img "src"
my question: I have an img tag
<img class="myclassname" src="1.jpg" name="2.jpg">
I would like to change the img source (currently 1.jpg) to the one I wrote in the "name" attribute (2.jpg) using jquery.
why doesn't it work?
$(".myclassname").attr("src", $(this).attr("name"));
thanks for any help! hails mafka
(ps: the script is of course more complicated, but this is the problem I'm stuck with)
+2
user173163
source
to share