Very simple question concerning displaying titles

Very simple question concerning displaying titles

Firstly I've used jquery for about an hour now so that's how little I know, that's why this should be simple as :)

Ok So I've been reading the docs on ids and ".attr"'s and have achieve half of what I need to do. I've used this:

$(".main_view").text($(".test2").attr("title"));

to get the title of an image and then display it. This works fine except it gets rid of the image. I want to be able to use display the image and use the title as a caption. After I've achieved this I'd also like to be able to put that title in a div so I can use css to muddle with it.

Thanks for reading and answering my dumb question :)