Solved

Jquery append image source after image

Posted on 2013-01-03
4
340 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
Comment Utility
$(document).ready(function() {

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

})

Open in new window

0
 

Author Comment

by:garyilm
Comment Utility
that didn't work
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
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
Comment Utility
Perfect thanks. Can this be made into a link?
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
The viewer will learn how to dynamically set the form action using jQuery.
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…

771 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

7 Experts available now in Live!

Get 1:1 Help Now