$("[id^=POST_][id$=_THEME]")
It will return all the elements that matches all the specified attribute filters: source
[id^=POST_]
[id$=_THEME]
[class$=_THEME]
link.className = 'MY_THEME_ONE';
$("[class^=_THEME]").each(function () {
if (link.className != this.className) $(this).remove();
});