本文转自:http://naspinski.net/post/jQuery-TextBox-Water-Mark-with-aspnet.aspx

I stole majority of this code from

http://www.aspcode.net/A-watermark-texbox-with-JQuery-and-aspnet.aspx

but I added a bit to make it swap css classes as well


$().ready(function() {
swapValues = [];
$(".wm").each(function(i) {
swapValues[i] = $(this).val();
$(this).focus(function() {
if ($(this).val() == swapValues[i]) {
$(this).val("").removeClass("watermark") }
}).blur(function() {
if ($.trim($(this).val()) == "") { $(this).val(swapValues[i]).addClass("watermark") } }) })
}); To use it, make sure your TextBox has (one of) it's css classes set to "wm". If you want a seperate style to be applied add that initially as well, in my example, it swaps "watermark" in and out as a css class. <asp:TextBox ID="txt" runat="server"
Text="this is the watermark" CssClass="wm watermark" />

[转]jQuery TextBox Water Mark with asp.net的更多相关文章

  1. High Water Mark 图示

    +---- high water mark of newly created table | V +-------------------------------------------------- ...

  2. oracle:block 的 water mark问题

    看了小布老师关于block里面数据存储的high water mark的实验,自己也做了一遍. SQL> create table x(i int,name varchar(20)); Tabl ...

  3. 高水线 High water mark(HWM)

    所有的Oracle表都有一个容纳数据的上限(很像一个水库历史最高的水位),我们把这个上限称为“High water mark"或HWM.这个HWM是一个标记(专门有一个数据块来记录高水标记等 ...

  4. jQuery UI Autocomplete Combobox 配 ASP.NET DropDownList

    0.引言   1.起因                  一开始使用Autocomplete做了一个自动补全的文本框,如上图.后来因业务需要希望能在这个文本框的边上做个下拉列表按钮,一按就展开所有支持 ...

  5. jQuery AJAX and HttpHandlers in ASP.NET

    https://www.codeproject.com/Articles/170882/jQuery-AJAX-and-HttpHandlers-in-ASP-NET Introduction In ...

  6. jQuery Ajax传递数组到asp.net web api参数为空

    前端: var files = []; files.push({ FileName: "1.jgp", Extension: ".jgp", FileType: ...

  7. JQuery Form AjaxSubmit(options)在Asp.net中的应用注意事项

    所需引用的JS: 在http://www.malsup.com/jquery/form/#download 下载:http://malsup.github.com/jquery.form.js 在ht ...

  8. [转]jQuery AJAX pagination plugin with ASP.NET Server Side

    本文转自:http://do-web.com/jpaging/usage How does it work? 1. In order to implement the plugin, you need ...

  9. Jquery TextBox进入focus的时候 改变background-color

    <!DOCTYPE html><html><head><script src="/jquery/jquery-1.11.1.min.js" ...

随机推荐

  1. Python学习笔记--2--面向对象编程

    面向对象 类和装饰器@ #coding=gbk class student: def __init__(self,name,grand):#初始化构造函数,self相当于java中的this,相当于一 ...

  2. margin,CSS边距重叠

    CSS外边距叠加就是margin-collapse,边距合并指的是,当两个垂直外边距相遇时,它们将形成一个外边距,水平边 距永远不会重合. 重叠结果计算规则: 两个相邻的外边距都是正数时,折叠结果是它 ...

  3. 基于jQuery的Tooltip

    近来,要开发一个关务管理系统,为了增加系统美观度,自己开发了一个基于jQuery框的的小插件,与大家分享一下,希望大家能给我提出宝贵修改意见. 下面开发说明使用方法和内容: 一.引用jQuery框架, ...

  4. 修改Oracle游标数及排查游标问题相关SQL

    查看当前游标数show parameter open_cursors; 修改游标最大数 ; commit; 查看游标消费情况 select o.sid, osuser, machine, count( ...

  5. hadoop学习记录--hdfs文件上传过程源码解析

    本节并不大算为大家讲接什么是hadoop,或者hadoop的基础知识因为这些知识在网上有很多详细的介绍,在这里想说的是关于hdfs的相关内容.或许大家都知道hdfs是hadoop底层存储模块,专门用于 ...

  6. Linux的防火墙iptables配置示例

    注:内容来自网络 一.关闭防火墙 1.重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off 2.即时生效,重启后失效: 开启:ser ...

  7. Glib学习笔记(三)

    你将学到什么 如何实现Object的方法 Object的方法 Object的public方法 在头文件声明一个函数,然后在源文件中实现函数即可 /* declaration in the header ...

  8. 关于执行memcached报错问题

    执行#/usr/local/memcached/bin/memcached随后出现如下错误:./memcached: error while loading shared libraries: lib ...

  9. CHUI类

    自定义控件程序运行流程 setNeedsLayOut和setNeedsDisplay区别 masonry使用技巧 1.普通展示 UILabel     UIView     UI控件的位置     U ...

  10. ubantu一些资料

    1.在引导页面中选中win10 按E键 进入编辑 在最后一行后面加上一行ntldr /bootmgr 再按F10引导,发现可以进入windows10 2.ubantu安装qq https://lear ...