JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<div class="usersonline">
	<a href="" usergroup="6">Dave</a> <a href="" usergroup="7">Test</a> <a href="" usergroup="6">Dave2</a>
</div>

<div class="legend">
	<span usergroup="6">Administrator</span> <span usergroup="7">Member</span>
</div>

JavaScript

$(".legend span").hover(function(){
	usergroup = $(this).attr('usergroup');
	$(".usersonline a").each(function(){
		if($(this).attr('usergroup') != usergroup){
			$(this).hide();
		}
	});
}, function(){
	$(".usersonline a").show();
});