I\'m probably doing something wrong but I\'ve tried all sorts of things and can\'t seem to get a collection of jQuery objects wrapped. The following just outputs the link HTML,
You need a string to pass into .html(), I think you're after this instead:
$dropdownSections[i].empty().append($primary.parent());
This gets the .parent() (since you just wrapped it in one) and sets the contents to that.