<div class="p">Первый</div>
<div class="p">Второй</div>
<div class="p">Третий</div>
<div class="p">Четвертый</div>
<button class="btn">Sum</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
var $num = $('.p'),
btn = $('.btn');
btn.on({
'click': sum
});
function sum() {
$num.append(function(i){return ' ' + ++i});
}
</script>