javascript - Validate form with Jquery validation -


i want validate form, had error :

uncaught typeerror: $(...).validate not function 

i included js files validation jquery-validate.min.js , jquery-validate.js.thanks

index.html

<form id="form1"> <label for="phone">first name</label> <input type="text" name="name" required /> <input type="button" id="btn" value="ok" /> </form> 

file.js

$(document).ready(function (){     $("#form1").validate({     rules: {         name: "required"     },     messages: {         name: "please specify name"      } })  $('#btn').click(function() {     $("#form1").valid(); });  }); 

check , note how scripts included:

$(document).ready(function (){          $("#form1").validate({          rules: {              name: "required"          },          messages: {              name: "please specify name"          }      });            $('#btn').click(function() {          $("#form1").valid();      });  });
#form1 label.error {      color: #fb3a3a;      display: block;      margin: 10px;      padding: 0;      text-align: left;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.13.1/jquery.validate.min.js"></script>    <form id="form1">  <label for="name">first name</label>  <input type="text" name="name" required />  <input type="button" id="btn" value="ok" />  </form>


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -