Q:

How to loop trough all elements and get their attribute Javascript

I'm learning javascript loops and arrays and I'm wondering if I can get all buttons attributes, like in my code when I click on submit button I want to loop through all buttons (with class "seat") attributes named "value" and to set statement if its "value=1" to change background color to red.
 <div id="tickets">
    <button value="0" class="seat">1</button>
    <button value="0" class="seat">2</button>
    <button value="0" class="seat">3</button>
    <button value="0" class="seat">4</button>
    <button value="0" class="seat">5</button>
    <button value="0" class="seat">6</button>
    <button value="0" class="seat">7</button>
    <button value="0" class="seat">8</button>
    <button value="0" class="seat">9</button>
    <button value="0" class="seat">10</button>
    <button id="submit-btn">Submit</button>
</div>

There is a JQuery code
$(".seat").click(function (e) { 
e.preventDefault();
let value = $(this).attr("value");
if (value === "0") {
    $(this).addClass("active");
    $(this).attr("value", "1");
}else if (value === "1"){
    $(this).removeClass("active");
    $(this).attr("value", "0");
}
});

Here I'm adding value to 1 and everything is working okay, its adding class Active and changing value, now I tryed to make loop and check all buttons values and if its 1 to add class which is changing background color to red, but I just cant figure out how to do that, tryed some solutions didtn worked.
EDIT 
Tryed with loop like this from @Kenny not working
$("#submit-btn").click(function () { 

$(".seat").each((elem) => {
    if ($(elem).attr('value') === '1') {
       $(elem).addClass('reserverd');
    }
 }); 

});

A:

How about this?
$(".seat").each((index, elem) => {
   if ($(elem).attr('value') === '1') {
      $(elem).addClass('background-red');
   }
});

A:

Your click handler runs with this referring to the button that was clicked. But in that handler (or a handler for a completely different button), you can also get all buttons the way you did when hooking up the handler: $(".seat"). You can loop through it with each. Within each, this (as with the event handler) is a reference to the button for that loop.
So you could do what you've done in your handler, just in an each callback instead:
// (You'd probably have this inside an event handler)
$(".seat").each(function() { 
    let value = $(this).attr("value");
    if (value === "0") {
        $(this).addClass("active");
        $(this).attr("value", "1");
    }else if (value === "1"){
        $(this).removeClass("active");
        $(this).attr("value", "0");
    }
});

I'd probably change the code updating value and the class list a bit, just FWIW:
// (You'd probably have this inside an event handler)
$(".seat").each(function() { 
    // HTML form elements have a `value` property you can use directly, no
    // need for jQuery to do it.
    this.value = this.value === "0" ? "1" : "0";

    // jQuery does make toggling a class a bit easier cross-browser:
    $(this).toggleClass("active", this.value === "1")

    // That said, on modern browsers (*not* IE, not even IE11), you could do this:
    // this.classList.toggle("active", this.value === "1")
});

(Sadly, although IE10 and IE11 have classList and toggle, they don't support the second argument to it.)

