I want to generate title attributes from existing anchor text, e.g.

<a href="foo.html">Foo Foo</a>

becomes

<a href="foo.html" title="Foo Foo">Foo Foo</a>

The code below works in FF3 with Firebug reporting no errors, but
Safari reports a parsing error. IE is no go.

$('a').attr('title' , function() $(this).text());

adding curly brackets clears the parsing error in Safari but doesn't
function in any browser.

$('a').attr('title' , function() { $(this).text() } );

I must be missing something simple here.

Reply via email to