smartFocus

程序名称:smartFocus

smartFocus 介绍

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

smartFocus 官网

http://plugins.jquery.com/project/smartFocus

相关编程语言

多功能下拉选择插件 SelectPage 简洁而强大的下拉分...
AutoComplete 是一个 jQuery Mobile 的插件,用于实...
Combogrid 是一个jQuery插件用于为输入框添加高级自...
Autobox2这个jQuery插件,可以用于创建类似于Facebo...
Link Scraper TextBox 是一个文本框的扩展插件,当你...
Awesomplete 超小超好用的超漂亮的 autocomplete 框...