标签:describe 数组 inpu head 使用 submit 地方 必须 lap
---恢复内容开始---
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 <script src="./jquery-3.2.0.js"></script> 7 <script src="./validate-master/jquery-validate.js"></script> 8 </head> 9 <body> 10 <form > 11 数组字母: 12 <input type="text" name="word" 13 data-describedby="for_word" //显示错误信息的地方 14 data-description="aaa" //要提示的内容 15 data-required //规定表单内容不能为空 16 data-pattern="^[a-zA-Z]+$"> //验证规则 17 <span id="for_word"></span> 18 <br> 19 20 输入数字: 21 <input type="text" name="number" 22 data-describedby="for_number" 23 data-description="bbb" 24 data-required 25 data-pattern="^\d+$"> 26 <span id="for_number"></span> 27 <br> 28 <input type="submit"> 29 </form> 30 <script> 31 $( ‘form‘ ).validate({ 32 description: { 33 aaa: { 34 required: ‘必须填写内容‘, 35 pattern: ‘必须填写字母‘ 36 }, 37 bbb: { 38 required: ‘必须填写内容‘, 39 pattern: ‘必须填写数字‘ 40 } 41 } 42 }); 43 44 </script> 45 </body> 46 </html>
---恢复内容结束---
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 <script src="./jquery-3.2.0.js"></script> 7 <script src="./validate-master/jquery-validate.js"></script> 8 </head> 9 <body> 10 <form > 11 数组字母: 12 <input type="text" name="word" 13 data-describedby="for_word" //显示错误信息的地方 14 data-description="aaa" //要提示的内容 15 data-required //规定表单内容不能为空 16 data-pattern="^[a-zA-Z]+$"> //验证规则 17 <span id="for_word"></span> 18 <br> 19 20 输入数字: 21 <input type="text" name="number" 22 data-describedby="for_number" 23 data-description="bbb" 24 data-required 25 data-pattern="^\d+$"> 26 <span id="for_number"></span> 27 <br> 28 <input type="submit"> 29 </form> 30 <script> 31 $( ‘form‘ ).validate({ 32 description: { 33 aaa: { 34 required: ‘必须填写内容‘, 35 pattern: ‘必须填写字母‘ 36 }, 37 bbb: { 38 required: ‘必须填写内容‘, 39 pattern: ‘必须填写数字‘ 40 } 41 } 42 }); 43 44 </script> 45 </body> 46 </html>
标签:describe 数组 inpu head 使用 submit 地方 必须 lap
原文地址:http://www.cnblogs.com/2026tu/p/7902748.html