jquery文本框提示
来源:互联网 发布:win10下载不了软件 编辑:程序博客网 时间:2024/04/28 09:50
文本框输入提示语在,在用户设置的的时候经常性的使用,还是jquery好用,自定义一个属性,把要提示的信息全部写在自定义的属性里面。
< html xmlns="http://www.w3.org/1999/xhtml">
< head>
< meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
< title>无标题文档</title>
< script type="text/javascript" language="javascript" src="Js/jquery.js">
< script type="text/javascript" language="javascript">
$(function(){
$("[placeholder]").css("color","#ccc")
$("[placeholder]").focus(function() {
var input = $(this);
if (input.val() == input.attr("placeholder")) {
input.val("");
input.removeClass("placeholder");
}
}).blur(function() {
var input = $(this);
if (input.val() == "" || input.val() == input.attr("placeholder")) {
input.addClass("placeholder");
input.val(input.attr("placeholder"));
}
}).blur();
$("[placeholder]").parents("form").submit(function() {
$(this).find("[placeholder]").each(function() {
var input = $(this);
if (input.val() == input.attr("placeholder")) {
input.val("");
}
})
});
});
< /script>
< /head>
< body>
< input type="text" value="" placeholder="你的大名"/>
< /body>
< /html>
但是网上大多数都是把文本框提示的内容也一起提交了,那样就只给出了一个效果,没多大用处,加上下面这段代码则不会提交提示内容
$("[placeholder]").parents("form").submit(function() {
$(this).find("[placeholder]").each(function() {
var input = $(this);
if (input.val() == input.attr("placeholder")) {
input.val("");
- jquery文本框提示信息
- jquery 文本框提示标签
- jquery文本框提示
- jQuery插件,自动提示,文本框自动匹配
- jquery artTxtCount 文本框输入字数提示
- jQuery 制作自动提示的文本框
- jQuery学习笔记2 文本框水印提示
- jquery+ajax+text文本框智能提示
- jquery实现文本框Email自动提示后缀
- 文本框/域文字提示自动显示隐藏jQuery小插件
- jquery实现文本框闪烁提示用户验证信息
- 文本框自动匹配提示功能(JQuery-AJAX)
- 文本框输入内容进行动态提示(jquery部分)
- jQuery实现点击文本框弹出热门标签的提示示例
- jQuery+JavaScript+PHP 制作简单的文本框输入自动提示
- Asp.net文本框输入提示功能(jquery-ui)
- Asp.net文本框输入提示功能(jquery-autocomplete)
- jquery.tiptext.js 文本框、文本域文字提示工具
- o(n)时间寻找第k小的数
- poj 2411 Mondriaan's Dream
- Setup Factory 7.0打包工具(写注册表)
- c语言测试代码运行时间
- PVR实用技术使用介绍
- jquery文本框提示
- MFC中定义全局变量
- POJ 2253 Frogger 最短路-Dijkstra的变形形式
- RabbitMQ学习笔记
- 图形打印问题
- windows下Django无法创建superuser的问题
- AMQP协议
- java byte int 讲解
- iOS 推送详解 push