Close, the anchor is a child of the li
, to you can use find
. The .pdf
is actually a sibling, but is also the previous element, so use .prev
. You also need to build the actual a
element and append:
$('.weiter').each(function() {
var href = $(this).find("a").attr('href') + "&type=999",
link = "<a href='" + href + "' target=_blank>PDF</a>";
$(this).prev('.pdf').append(link);
});