доброе времени суток есть форма как в валидации поставить мин макс символов ставлю if (name == '' && length > 4 ) не работает 2) добавить тип инпута в валидацию ,текст, емайл ,,,,
<form id="myForm" onsubmit="send_form(); return false;" action="" method="POST">
<p class="mt-3 "> First name </p>
<div class="form-group" >
<input type="text" class="form-control " name="first_name" id="first_name" placeholder=" Enter your first name" required id="first_name">
<span class="form-block" id="block-name"></span>
</div>
<p class="mt-3 "> Last name </p>
<div class="form-group">
<input type="text" class="form-control " name="last_name" id="last_name" placeholder=" Enter your last name " required min="2" max="30">
<span class="form-block"></span>
</div>
<p class="mt-3 "> Email </p>
<div class="form-group">
<input type="email" class="form-control" name="email" id="email" aria-describedby="emailHelp" placeholder=" Enter your Email " required min="2" max="30">
<span class="form-block"></span>
</div>
<p class="mt-3 ">Phone </p>
<div class="form-group">
<input type="number" class="form-control " name="phone" id="phone" placeholder="+ XX (XXX) XXX XX XX " required min="7">
<span class="form-block"></span>
</div>
<p class=" mt-5 border-bottom-main"> Your question </p>
<p class="mt-4 mb-2">Message</p>
<div class="form-group align-items-start">
<textarea class="form-control" rows="6" name="message" placeholder="Enter your question" id="message" required="" min="4"></textarea>
<span class="form-block"></span>
</div>
<div class="row">
<div class="col-12 col-md-5 col-lg-5 offset-md-7 mt-4">
<button type="submit" class="button button-home" onclick="valid()" >Submit </button>
</div>
</div>
</form>
function valid() {
let name = $('#first_name').val().length;
if (name == '' && length > 4 ) {
$('#first_name').css('border', '1px solid #E2402D')
$('#first_name').css('box-shadow', 'none')
$('#block-name').css('background-image', 'url(img/error.png)')
} else {
$('#first_name').css('border', '1px solid #313348')
$('#first_name').css('background-image', 'none')
$('#block-name').css('background-image', 'url(img/done.png)')
}
alert(name)
}