jquery Plugin Validate Learning

Source: Internet
Author: User

jquery is very handy for now.

First you should understand a question:

<p>

<label for= "Password" >Password</label>

<input id= "password" name= "password" maxlength= "/>"

</p>

Who is the parent element of <input >?

Of course, if you don't see it, we can use a Chrome browser to make it look true;

<script src= "Assert/jquery-1.11.3.min.js" ></script>
<script>
$ (document). Ready (function () {
Alert ($ ("#password"). Parent (). text ());

});

In the Chrome browser is actually password, well, it should be it. This is the label label for property. Why would I mention this? Then you'll see.

jquery compatibility is very good at the moment, so the official jquery also provides a lot of useful plug-ins, today to learn to express plug-ins;

<! DOCTYPE html>

  

This is what happens after this operation.

First explain the following:

<link href= "Assert/css/milk.css" rel= "stylesheet"/>
This is my own add, my Learning to build the document directory is as follows:

You can see that this is the style of validating success and failure,
1 input.error{border:1px solid red;}2 label.error{3 Background:url (".. /image/unchecked.gif ") no-repeat 0px 0px;4 padding-left:16px;5 padding-bottom:2px;6 Font-weight:bold;7 color: #EA5200;8 }9 label.checked{Ten Background:url (".. /image/checked.gif ") no-repeat 0px 0px; One}

Why do I add a style like this, because jquery defaults to storing the error in a label note.

Know why, the above can also be modified on their own.

Background:url (".. /image/unchecked.gif ") no-repeat 0px 0px;

,
<script src= "Assert/jquery-1.11.3.min.js" ></script>    <script src= "assert/ Jquery.validate.min.js "></script>
These two are required to be introduced,
The rules contain all the validation rule, the message is the information to verify the success prompt, success:string,function, if success:string,string will be considered a CSS style class, According to this context is checked. You can also follow a function that defines a successful typeface.

Hightlight: Is get highlight, get text focus, in this article, if you enter text, validation error, it will erase the original content.

Only here today, if you want to learn the complete tutorial please visit:

Beginner's Tutorial | Jquery Validate "

jquery Plugin Validate Learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.