How do I check for validation?

Moderators, correct me RV

All Shalom! Want to do validation of fields I have a form that works in steps, how do I do if the field is empty then the next step is not to show?

It is necessary that all were validated except for input name

Here is the code jquery
$(document).ready(function () {
 var steps = $('form').children('.tab');
$(steps[0]).show();
 var current_step = 0;
 $('form button.next').click(function () {
 if (current_step >= steps.length - 2) {
$(this).hide();
 $("form button.signup").show();
}
current_step++;
$(steps).hide();
$(steps[current_step]).show();
});
});


Code HTML
<form id="regForm" action="" method="post">
 <div class="tab">
 <h4>Your phone number</h4>
 <p>Please confirm your country code and enter the phone number.</p>
 <div class="error">
 <span>Invalid phone number</span>
</div>
 <p><input type="text" name="phone" id="phone" placeholder="+380"></p>
</div>

 <div class="tab">
 <h4 id="title-phone"></h4>
 <p>We have sent you a message with activation code on your phone. Please enter it below.</p>
 <div class="error">
 <span>Invalid activation code</span>
</div>
 <p><input type="text" name="code" placeholder="Your code"></p>
</div>

 <div class="tab">
 <h4>Your information</h4>
 <p>Please enter your name and upload a photo.</p>
 <div class="photo">
<span></span>
</div>
 <div class="error">
 <span>Enter your name</span>
</div>
 <p><input type="text" placeholder="Name" id="firstname"></p>
 <p><input placeholder="last Name (optional)"></p>
</div>

 <button type="button" class="next">continue</button>
 <button type="button" class="signup" style="display: none;">REGISTER</button>
</form>


css won't throw, that makes no sense, the form itself works on the steps as I need, but I need to do validation, I can not understand how, I wish you showed me how to do it because I finished my code a bit, everyone will be grateful!
April 7th 20 at 15:22
1 answer
April 7th 20 at 15:24
Solution
if (step.eq(current_step).find('input').val().length === 0) {
 // show error
return;
}
Thank you, what helped - Precious_Zemlak17 commented on April 7th 20 at 15:27

Find more questions by tags HTMLJavaScriptjQuery