Timeline for answer to Replace "img" in jquery by Tro
Current License: CC BY-SA 3.0
Post Revisions
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 17, 2013 at 9:11 | vote | accept | Community Bot | ||
| Jul 12, 2013 at 10:32 | comment | added | Tro |
var homenewsimage = $(this).closest("li").find("img").attr("src"); $(homeimage).attr("src", homenewsimage); should hopefully work.
|
|
| Jul 12, 2013 at 10:27 | comment | added | user2575867 | i´m really stuck somehow, at the moment i absolutly dont get it. i tried this now var homenewsimage = $(this).closest("li").find("img").html(); $(homeimage).attr("src", $(homenewsimage)); but it wont work | |
| Jul 12, 2013 at 10:11 | comment | added | Tro |
Can't you make your homenewsimage variable be the src for the image rather than the entire HTML tag? If so, this would work just as well, otherwise you'll just have to use a bit more javascript to abstract the text between double quotes from your homenewsimage before then making that the src.
|
|
| Jul 12, 2013 at 9:57 | comment | added | user2575867 | yeah this somehow works, but i dont want to type in the src of the picture manually. i want it to automatically read out the <img src="placehold.it/238x131"> | |
| Jul 12, 2013 at 9:47 | history | answered | Tro | CC BY-SA 3.0 |