jquery validate&metadata 插件实例教程2

2019-03-03 08:35|来源: 领悟书生

jquery validate与metadata一起使用,直接在标签中校验

代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>jquery validate 插件实例02</title>
    <meta name="author" content="Administrator" />
    <link rel="stylesheet" type="text/css" href="js/css/screen.css" />
    <script type="text/javascript" src="js/jquery-1.9.0.js"></script>
    <script type="text/javascript" src="js/jquery.validate.js"></script>
    <script type="text/javascript" src="js/jquery.metadata.js"></script>
    <script type="text/javascript">
    $(function(){
            $("#myform").validate();
    })
    </script>
</head>
<body>
    <form id="myform" action="#">
    Username:<input type="text" id="username" name="username"
    class="{required:true, messages:{required:'Please enter username'}}"/><br/>
    Address:<input type="text" id="address" name="address"
    class="{required:true,messages:'地址不能为空'}"/><br/>
    Age:<input type="text" id="age" name="age"/><br/>
    password:<input type="text" id="pwd" name="pwd"/><br/>
    confirm password:<input type="text" id="cpwd" name="cpwd"/><br/>
    <input type="submit" />
    </form>
</body>
</html>


本文链接:jquery validate&metadata 插件实例教程2,由领悟书生原创

转载请注明出处【http://www.656463.com/article/359】

相关问答

更多
  • 实例教程.....[2023-04-11]

    我要自学网 http://www.51zxw.net/ AutoCAD应用教程集-eNet网络学院 http://www.enet.com.cn/eschool/zhuanti/jcwautocad/ AutoCAD室内外施工图绘制精讲教程-eNet硅谷动力网络学院 http://www.enet.com.cn/eschool/zhuanti/autocad2006/ cad快捷键大全 http://hi.baidu.com/langkeyan/blog/item/acbd16d1e29e4ed7572c8 ...
  • indesign实例教程[2022-08-23]

    帮你搜索了一下 http://zhidao.baidu.com/question/33595441.html?si=2 感谢这位作者。
  • 这是网易学院的 http://tech.163.com/special/000915SN/st21autocad.html 这是CAD基础课程 http://www.joxue.com/no02/pc/photos01/photos05/
  • 基础篇的内容主要是介绍 visual basic 6.0 入门的一些基础知识。包括安装 visual basic 6.0 的方法、visual basic 6.0的工作环境等等。本篇综述了visual basic 6.0的编程规格、编程的基本结构以及事件驱动拍机制等内容。掌握这些知识,有利于读者迅速掌握visual basic 6.0.有利于理解visual basic的编程工体原理。 第一部分涉及的内容有: 1.visual basic 6.0 的发展历程和 visual basic 6.0 的新增功能 ...
  • 动画制作的要就留下个联系方式给你
  • 求jQuery代码教程[2022-03-27]

    我找了一些教程不知道适合不适合你。 希望对你有帮助 http://www.yeeyan.com/articles/tag/jquery http://www.k99k.com/jQuery_getting_started.html
  • jquery的api文档里面都有例子的
  • jquery的api文档里面都有例子的
  • 这可以通过一个简单的两步过程完成: 声明你自己的验证方法 。 在该方法中,您将比较两个输入元素。 在两个输入元素之一中引用验证方法。 This can be done in a simple two-step process: Declare your own validation method. In that method you would compare the two input elements. Reference the validation method in one of the two ...
  • 正如您发现的,使用eval的“错误”在于元数据插件,而不是验证插件。 您链接到的元数据插件的版本实际上是一个分叉; jQuery团队有官方回购 。 如果您查看提交历史记录 ,则会看到自2007年以来没有任何实际的代码更新。自2011年4月以来,该插件已被正式弃用 。 (John Resig在2008年7月发表了关于HTML5数据属性的博客,并且jQuery核心支持也在2010年10月发布的1.4.3版本中发布。) 所以我想你的问题“这可能发生了什么”的答案是,你不会再使用插件了:-) ( 更新: “官方”回 ...