<form class=".form" action="">
<input type="text" class="inputs"><br>
<input type="text" class="inputs"><br>
</form>
<button>Check</button>
$("button").on("click", function () {
if($(".inputs").val()) {
$("body").css("background-color", "yellow");
} else {
$("body").css("background-color", "red");
}
});
As you may see, I want to check for a value in inputs and based on that select a color for a body. The problem is, it checks only the first element among all of them.
You can try to enter a value in the second input and leave the first one empty and see this.
I want to check all of the inputs for a value with AND condition, how do I do this?
Thanks