"user_id"
Bootstrap 4.1.1 Snippet by krunb

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row mt-5"> <div class="col-lg-6"> <form id="form" action="" method="post"> <div class="form-group"> <label for="">Full Name</label> <input type="text" name="" id="name" class="form-control" placeholder=" Full Name" onkeyup="derectedName()"> </div> <button type="submit" class="btn btn-primary">Submit</button> </form> </div> </div> </div>
function derectedName(){ var n = $("#name").val(); var spaceCount = 0; for(let i = 0 ; i < n.length ; i++){ if(n[i] == ' ') spaceCount++; if(spaceCount >= 2){ return true; } } return false; } $("#form").submit( function(e){ var name = derectedName(); if(name != true){ alert(" يجب ان يحتوي الاسم على 3 كلمات"); e.preventDefault(); }else{ alert("submit !!"); } });

Related: See More


Questions / Comments: