一个模仿HTML5功能的jquery控件

 

原文:http://www.matiasmancini.com.ar/html5form_en.php

大致将要点翻译下:
  在HTML5中,验证输入框等都可以不用JAVASCRIPT就能实现了,现在只有少部分浏览器
支持这个功能;现在,可以使用jquery插件去模拟这个功能了。安装:
<head>
    
    //jQuery library
    <script src="http://code.jquery.com/jquery-1.4.2.min.js%22%3E%3C/script>
    
    //jQuery.html5form plugin
    <script src="http://html5form.googlecode.com/svn/trunk/jquery.html5form-min.js">
    </script>
   
    <script>
        $(document).ready(function(){
            $('#myform').html5form();   
        });
    </script>

</head>

HTML5的一些特征如下:
1)属性placeholder
  <input type="text" placeholder="Full Name"/>
placeholder的作用是,当你在文本框没输入任何东西,时,
会自动光标停留在文本框中
2)EMAIL
 <input type="email" name="email" id="email"/>
3)TEXTAREA
  <textarea maxlength="60" name="comment" id="comment"/>
4) URL
  <input type="url" name="website" placeholder="http://%22/>
这个表明必须输入的是url
  使用这个控件
<script>
   
    $('#myform').html5form({
       
        async : false, // cancels the default submit method.
        method : 'GET', // changes the request method.
        action : 'respuesta.php', // changes the action method.
        responseDiv : '#respuesta' // a content div to get the callback function response.
       
    })
   
</script>

5 当有多个form时
 <script>

    $('#myform_one').html5form({
        method: 'POST',
    });

    $('#myform_two').html5form({
        method: 'GET'
    });

</script>

支持所有浏览器:
<script>

    $('#myform').html5form({
        allBrowsers: true
    });

</script>

下载见:
http://html5form.googlecode.com/svn/trunk/jquery.html5form-min.js

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值