Add a class to your third link so that you can help jQuery identify it.
<li><a href="#" class="third">Third Link</a></li>
Then instruct your code to add the .selected
class to it if an anchor with the .learnmore
class is clicked.
$('a').click( function() {
$('a').not(this).removeClass('selected');
$(this).addClass('selected');
// new code below
if ($(this).hasClass('learnmore')) {
$('a.third').addClass('selected');
};