资 源 简 介
// jPlaceholder Plugin for jQuery - Version 0.2
// by Angel Grablev for Enavu Web Development network (enavu.com)
// Dual license under MIT and GPL :) enjoy
/
To use simply call .jPlaceholder() on the element you wish like so:
$("#content").jPlaceholder();
you can specify the following options:
css_class = allows you to specify the class for the placeholder
**/
(function($) {
$.fn.jPlaceholder = function(options) {
var defaults = {css_class: "placeholder"};
var options = $.extend(defaults, options);
// handle form being submitted by clearing the populated fields
$("form").submit(function(){
$("input").each(function(){
if ($(this).attr("placeholder") != undefined) {
if ($(this).attr("placeholder") == $(this).attr("value")) { $(this).val(""); }
}