Solved

Jquery append image source after image

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article discusses how to create an extensible mechanism for linked drop downs.
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)

778 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