Thanks for pointing out the omission. I'll use this solution as it's
more compact.
Jonny
On Mar 5, 6:49 am, Klaus Hartl wrote:
> > $('a').attr('title' , function() { $(this).text() } );
>
> > I must be missing something simple here.
>
> Yes, a return statement.
>
> $('a').attr('title' , functio
> $('a').attr('title' , function() { $(this).text() } );
>
> I must be missing something simple here.
Yes, a return statement.
$('a').attr('title' , function() { return $(this).text(); });
--Klaus
Many thanks for your quick response Brian. Works fine.
Images do produce an empty title string as you predicted. I'm solely
targeting text so no problem there.
Jonny
On Mar 4, 11:27 pm, brian wrote:
> $('a').each(function()
> {
> $(this).attr('title', $(this).text());
>
> });
>
> Keep
$('a').each(function()
{
$(this).attr('title', $(this).text());
});
Keep in mind, though, that an anchor might have an image inside,
rather than text. I doubt it'd be an issue. I guess jquery would
simply set it to the empty string.
On Wed, Mar 4, 2009 at 6:11 PM, Jonny Stephens wrote:
4 matches
Mail list logo