How to complete step5?


i can complete the other steps by using jquery like this:
but as for the final step, I can't get through with the code below(here #test is the id of the img):
I don't know how to do then


That worked for me

var main = function() {
$('.meme').children().attr('src', $(this).val());



Hi mirremarrer, could you explain why you put .children() in this line of code: ('.meme').children().attr('src', (this).val());?

Thanks for helping.


Hi alessandrohtml5,

I put ('.meme').children().attr('src', (this).val()) - to search for a child in the class .meme that has a source to an image and replace that source name (at the beginning “cat.jpg”) with what you put into #image-url.
It works in this case with children cause .meme has only one image as direct child. If there would be multiple children that were images the code would need to be more specific otherwise you would overwrite all image names and change them accordingly.

Hope that helps.


Thanks a lot mirremarrer, that did help.