JSFiddle - React, Tailwind, and code Playground
HTML
<div id="step-1" class="step">
<p><button>Test</button></p>
<p><button>Test</button></p>
<p><button>Test</button></p>
<p><button>Test</button></p>
</div>
<div id="step-2" class="step">
<p><button>Test</button></p>
<p><button>Test</button></p>
<p><button>Test</button></p>
<button>Test</button>
</div>
JavaScript
$('button').click(function() {
var that = this;
var fromIndex = null;
$(this)
.closest('.step')
.find('button')
.filter(function(index, element) {
if(fromIndex !== null && index > fromIndex) {
return true;
} else if(fromIndex === null && element == that) {
fromIndex = index;
return false;
}
})
.prop("disabled", true);
});