Created
March 21, 2013 09:20
-
-
Save dragstarcrowant/5211751 to your computer and use it in GitHub Desktop.
JS: form tips
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* jQuery Form Tips 1.2.6 | |
* By Manuel Boy (http://www.manuelboy.de) | |
* Copyright (c) 2012 Manuel Boy | |
* Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php | |
*/ | |
(function(a){a.fn.formtips=function(b){var c=a.extend({tippedClass:"tipped"},b);return this.each(function(){var b=a(this);var d=a(b).attr("type");if(d!="file"&&d!="checkbox"&&d!="radio"){a(b).bind("focus",function(){var b=a(this).attr("title");if(a(this).val()==b){a(this).val("").removeClass(c.tippedClass)}return true});a(b).bind("blur",function(){var b=a(this).attr("title");if(a(this).val()==""){a(this).val(b).addClass(c.tippedClass)}return true});var e=a(b).attr("title");if(a(b).val()==""||a(b).val()==a(this).attr("title")){a(b).val(e).addClass(c.tippedClass)}else{a(b).removeClass(c.tippedClass)}a(b).parentsUntil("form").parent().submit(function(){var d=a(b).attr("title");if(a(b).val()==d){a(b).val("").removeClass(c.tippedClass)}})}})}})(jQuery) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment