Home Web Front-end JS Tutorial How to use Jquery form validation plug-in formValidator_jquery

How to use Jquery form validation plug-in formValidator_jquery

May 16, 2016 pm 03:07 PM

使用步骤:

1.首先在项目中添加必备js与css

 

2.代码中添加引用(必备引用)

1

2

3

4

<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <!--jquery必须库-->

<script src="formValidator1/formValidator-4.0.1.min.js" type="text/javascript"></script> <!--表单验证必须库-->

<script src="formValidator1/formValidatorRegex.js" type="text/javascript"></script> <!--表单验证扩展库-->

<link href="formValidator1/style/validator.css" rel="stylesheet" type="text/css" /><!--表单验证样式表-->

Copy after login

3.中要验证的标签(做一些常用的演示)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

<table border="0px" style="font-size:12px">

 <tr>

   <td colpan="3"><input type="submit" name="button" id="button" value="提交" /></td>

  </tr>

  <tr>

   <td align="right">身份证(正则表达式库):</td>

   <td><input name="sfz" type="text" id="sfz" /></td>

   <td><div id="sfzTip" style="width:300px"></div></td> <!--必须注意这里提示验证信息中的div的id值,跟要验证控件中的id值多了一个Tip,下面的都是这样。必须多的是Tip,也必须要多。-->

  </tr>

  <tr>

   <td align="right">身份证(外部函数):</td>

   <td><input type="text" id="sfz1" style="width:120px" /></td>

   <td><div id="sfz1Tip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">整数:</td>

   <td><input type="text" id="zs" style="width:120px" /></td>

   <td><div id="zsTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">正整数:</td>

   <td><input type="text" id="zzs" style="width:120px" /></td>

   <td><div id="zzsTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">负整数:</td>

   <td><input type="text" id="fzs" style="width:120px" /></td>

   <td><div id="fzsTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">数字:</td>

   <td><input type="text" id="sz" style="width:120px" /></td>

   <td><div id="szTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">正数(正整数 + 0):</td>

   <td><input type="text" id="zs1" style="width:120px" /></td>

   <td><div id="zs1Tip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">负数(负整数 + 0):</td>

   <td><input type="text" id="fs" style="width:120px" /></td>

   <td><div id="fsTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">浮点数:</td>

   <td><input type="text" id="fds" style="width:120px" /></td>

   <td><div id="fdsTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">正浮点数:</td>

   <td><input type="text" id="zfds" style="width:120px" /></td>

   <td><div id="zfdsTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">负浮点数:</td>

   <td><input type="text" id="ffds" style="width:120px" /></td>

   <td><div id="ffdsTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">非负浮点数(正浮点数 + 0):</td>

   <td><input type="text" id="fffds" style="width:120px" /></td>

   <td><div id="fffdsTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">非正浮点数(负浮点数 + 0):</td>

   <td><input type="text" id="fzfds" style="width:120px" /></td>

   <td><div id="fzfdsTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">颜色:</td>

   <td><input type="text" id="ys" style="width:120px" /></td>

   <td><div id="ysTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">你的EMAIL:</td>

   <td><input type="text" id="email" style="width:120px" /></td>

   <td><div id="emailTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">手机:</td>

   <td><input type="text" id="sj" style="width:120px" /></td>

   <td><div id="sjTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">邮编:</td>

   <td><input type="text" id="yb" style="width:120px" /></td>

   <td><div id="ybTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">非空:</td>

   <td><input type="text" id="fk" style="width:120px" /></td>

   <td><div id="fkTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">图片:</td>

   <td><input type="text" id="tp" style="width:120px" /></td>

   <td><div id="tpTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">压缩文件:</td>

   <td><input type="text" id="rar" style="width:120px" /></td>

   <td><div id="rarTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">ip4:</td>

   <td><input type="text" id="ip4" style="width:120px" /></td>

   <td><div id="ip4Tip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">QQ号码:</td>

   <td><input type="text" id="qq" style="width:120px" /></td>

   <td><div id="qqTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">国内电话:</td>

   <td><input type="text" id="dh" style="width:120px" /></td>

   <td><div id="dhTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">用户名:</td>

   <td><input type="text" id="yhm" style="width:120px" /></td>

   <td><div id="yhmTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">字母:</td>

   <td><input type="text" id="zm" style="width:120px" /></td>

   <td><div id="zmTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">大写字母:</td>

   <td><input type="text" id="dxzm" style="width:120px" /></td>

   <td><div id="dxzmTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">小写字母:</td>

   <td><input type="text" id="xxzm" style="width:120px" /></td>

   <td><div id="xxzmTip" style="width:300px"></div></td>

  </tr>

  <tr>

   <td align="right">身份证:</td>

   <td><input type="text" id="sfz" style="width:120px" /></td>

   <td><div id="sfzTip" style="width:300px"></div></td>

  </tr>

 </table>

Copy after login

4.

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1266
29
C# Tutorial
1238
24
Demystifying JavaScript: What It Does and Why It Matters Demystifying JavaScript: What It Does and Why It Matters Apr 09, 2025 am 12:07 AM

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

The Evolution of JavaScript: Current Trends and Future Prospects The Evolution of JavaScript: Current Trends and Future Prospects Apr 10, 2025 am 09:33 AM

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

JavaScript Engines: Comparing Implementations JavaScript Engines: Comparing Implementations Apr 13, 2025 am 12:05 AM

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

JavaScript: Exploring the Versatility of a Web Language JavaScript: Exploring the Versatility of a Web Language Apr 11, 2025 am 12:01 AM

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

Python vs. JavaScript: The Learning Curve and Ease of Use Python vs. JavaScript: The Learning Curve and Ease of Use Apr 16, 2025 am 12:12 AM

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration) How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration) Apr 11, 2025 am 08:22 AM

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

From C/C   to JavaScript: How It All Works From C/C to JavaScript: How It All Works Apr 14, 2025 am 12:05 AM

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

Building a Multi-Tenant SaaS Application with Next.js (Backend Integration) Building a Multi-Tenant SaaS Application with Next.js (Backend Integration) Apr 11, 2025 am 08:23 AM

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

See all articles