JSFiddle - React, Tailwind, and code Playground

HTML

<input class="order form-control vnumber" type="text" maxlength="1" name="Orderbox[]" required="true">
<input class="order form-control vnumber" type="text" maxlength="1" name="Orderbox[]" required="true">
<input class="order form-control vnumber" type="text" maxlength="1" name="Orderbox[]" required="true">
<input class="order form-control vnumber" type="text" maxlength="1" name="Orderbox[]" required="true">
<input class="order form-control vnumber" type="text" maxlength="1" name="Orderbox[]" required="true">
    <button id="btn1">submit</button>

JavaScript

$('#btn1').click(function () {

   
    // initialize the sum (total price) to zero
    var val = 0;
    var next_val=0;
    // we use jQuery each() to loop through all the textbox with 'price' class
    // and compute the sum for each loop
 $('.order').each(function() {
    val=$(this).val();
    alert(val);
    if (next_val==val) {
          alert("same value");
    }
    next_val=val;
 });
});