Can append text, but not results of a selector chain
Can you please tell me why
this works (by appending "foo" to the image caption):
- $(document).ready( function() {
$('#main_content div img').attr('title','foo');
$('#main_content div .caption').append($('#main_content div img').attr('title'));
});
but this doesn't
- $(document).ready( function() {
$('#main_content div .caption').append($('#main_content div img').attr('title'));
});
I wanted it to append the contents of the title attribute to the caption, so I'd know that my selectors were working.