Solved

Jquery append image source after image

Posted on 2013-01-03
4
346 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
[X]
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
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

Independent Software Vendors: 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

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 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…
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…

630 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