PonyS, так?
<!doctype html>
<html>
<head>
<meta charset="utf-8" /
<title></title>
<style>
.select {
background: red;
}
</style>
</head>
<body>
<p class="price">1</p>
<p class="price">2</p>
<p class="price">3</p>
<p class="price">4</p>
<p class="price">5</p>
<p class="price">6</p>
<p class="price">7</p>
<p class="price">8</p>
<p class="price">9</p>
<p class="price">10</p>
<input type="hidden" value="5" />
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script>
var count = $('input[type=hidden]').val(), i = 1;
$('.price').click(function() {
toggleClass(this);
});
function toggleClass(elem) {
if (i > count && !$(elem).hasClass('select')) return;
( $(elem).hasClass('select') ) ? ( $(elem).removeClass('select'), i-- ) : ($(elem).addClass('select'), i++);
}
</script>
</body>
</html>