You're close. $(this)
only works when you're in a function. In your case, you want to use $(this)
in a function that iterates through all the elements your selector finds, using each:
$("a").each(function() { $(this).attr("data-filter", $(this).attr("title")) });
Here's a basic fiddle.