smartFocus

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-11 15:13:03

软件介绍

A small plugin to inject a text into inputs ortextareas as a label.
The text is removed when the element is focused and re-injected onblur if the element is leaved blank.

Here is the code to include in an external js or to paste on the page:

jQuery.fn.smartFocus = function(text) {
$(this).val(text).focus(function(){
if($(this).val() == text){
$(this).val('');
}
}).blur(function(){
if( $(this).val() == '' ){
$(this).val(text);
}
});
};

USAGE EXAMPLE:

var mail = '* E-mail';
$('#mail').smartFocus(mail);

This will inject the text "* E-mail" into the element (an input or a textarea) with id='mail'

Grab

本文地址:https://codercto.com/soft/d/23153.html

数据结构算法与应用

数据结构算法与应用

塞尼 / 机械工业出版社 / 1999-3 / 49.00元

数据结构、算法与应用—C++语言描述(英文版),ISBN:9787111070177,作者:(美)塞尼 著一起来看看 《数据结构算法与应用》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

MD5 加密
MD5 加密

MD5 加密工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具