Solved

Jquery append image source after image

Posted on 2013-01-03
4
341 Views
Last Modified: 2013-02-14
I am looking to add the image source after the image. I need to do this for every image in a div.

Example
<img src="something.jpg" />

Would become
<img src="something.jpg" />somgething.jpg
0
Comment
Question by:garyilm
  • 2
  • 2
4 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 38741628
$(document).ready(function() {

$("img").each(function() { $(this).attr("src").insertAfter(this); });

})

Open in new window

0
 

Author Comment

by:garyilm
ID: 38741684
that didn't work
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 38741796
new one : http://jsfiddle.net/LP4zn/

$(document).ready(function() {

$("img").each(function() { $(document.createTextNode($(this).attr("src"))).insertAfter(this); });

})¿

Open in new window

0
 

Author Comment

by:garyilm
ID: 38741862
Perfect thanks. Can this be made into a link?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now