JSFiddle - React, Tailwind, and code Playground
HTML
<input id="a" class="activity_order" maxlength="2" size="2" type="text" value><br>
<input id="b" class="activity_order" maxlength="2" size="2" type="text" value><br>
<input id="c" class="activity_order" maxlength="2" size="2" type="text" value><br>
<input id="d" class="activity_order" maxlength="2" size="2" type="text" value><br>
<input id="e" class="activity_order" maxlength="2" size="2" type="text" value><br>
<input id="f" class="activity_order" maxlength="2" size="2" type="text" value><br>
<input id="g" class="activity_order" maxlength="2" size="2" type="text" value><br>
<input id="h" class="activity_order" maxlength="2" size="2" type="text" value><br>
<input id="i" class="activity_order" maxlength="2" size="2" type="text" value><br>
<input id="j" class="activity_order" maxlength="2" size="2" type="text" value><br>
JavaScript
$(".activity_order").keyup(function() {
var self = this;
var ary = [];
$(".activity_order").not(self).each(function(t) {ary.push(this.value);})
console.log(ary.max());
/* if(ary.max()==0){
if (this.value != 1) {
alert("must start with 1")
self.value = ""
}
}else{
next_value = ary.max() + 1;
if (next_value===this) {
}else{
alert("should be "+ next_value)
};
}*/
})