Jquery append image source after image

Posted on 2013-01-03
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.

<img src="something.jpg" />

Would become
<img src="something.jpg" />somgething.jpg
Question by:garyilm
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 82

Expert Comment

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

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


Open in new window


Author Comment

ID: 38741684
that didn't work
LVL 82

Accepted Solution

leakim971 earned 500 total points
ID: 38741796
new one :

$(document).ready(function() {

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


Open in new window


Author Comment

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
The viewer will learn how to dynamically set the form action using jQuery.
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)
Suggested Courses

734 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