I donβt know why no one paid close attention to this line:
.find('.minus').show();
where he definitely did not hide the del
element. In short, the only thing you need to do is add the correct CSS rule:
.minus { display: none; }
and that he, the first element will not show the del
link, and the rest will.
The limit for three elements is simple.
$("[parent element]").on('click', '.addoutcome', function() { if($('.addoutcome').length > 2) return; ... });
The best [parent selector]
necessary and completely depends on your layout. Basically, this is the element that wraps all these elements, the parent element of all of them.
source share