Edit in JSFiddle

<h3 class='random_1'>Строка 1</h3>
<h3 class='random_3'>Строка 2</h3>
<h3 class='random_2'>Строка 3</h3>
<h3 class='random_1'>Строка 4</h3>
<h3 class=''>Строка 5</h3>
<h3 class='random_2'>Строка 6</h3>
<h3 class=''>Строка 7</h3>
<h3 class='random_3'>Строка 8</h3>
<h3 class=''>Строка 9</h3>
<h3 class='random_3'>Строка 10</h3>

<a href='#' data-sort="all">Show all</a> | 
<a href='#' data-sort="random_1">rand_1</a> | 
<a href='#' data-sort="random_2">rand_2</a> | 
<a href='#' data-sort="random_3">rand_3</a>
body {
  background: #fff;
  padding: 20px;
  font-family: Helvetica;
}

#banner-message {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  font-size: 25px;
  text-align: center;
  transition: all 0.2s;
  margin: 0 auto;
  width: 300px;
}

button {
  background: #0084ff;
  border: none;
  border-radius: 5px;
  padding: 8px 14px;
  font-size: 15px;
  color: #fff;
}

#banner-message.alt {
  background: #0084ff;
  color: #fff;
  margin-top: 40px;
  width: 200px;
}

#banner-message.alt button {
  background: #fff;
  color: #000;
}
var items = $('h3');
$('a').on('click', function() {
	var sort = $(this).data('sort');
  if (sort !== 'all') {
  	items.hide();
    $('.'+ sort).show();
  } else {
  	items.show();
  }
	return false;
});