js限制input标签中只能输入中文

时间:2015-06-26    点击:82   

方法很简单,这里就不多BB了,直接奉上示例

<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>只能输入中文</title>
</head>
<body>
<input type="text" id="text" onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\u4E00-\u9FA5]/g,''))">
</body>
</html>

以上所述就是本文的全部内容了,希望大家能够喜欢。

jQuery实现鼠标划过添加和删除class的方法
jQuery实现网站添加高亮突出显示效果的方法
jQuery匹配文档链接并添加class的方法
jquery计算鼠标和指定元素之间距离的方法
jQuery检查事件是否触发的方法
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved