Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Simplest way to do cross-browser input watermarks
- // ---------------------------------------------------
- // Using 'defaultValue' (as opposed to simple 'value')
- // ensures that Firefox doesn't bug out when a user
- // types something in, then refreshes the page
- (function($) {
- $.fn.actsAsDefault = function() {
- $(this).focus(function() {
- if ($(this).val() === this.defaultValue) {
- $(this).val('');
- }
- }).blur(function() {
- if ($.trim($(this).val()) === '') {
- $(this).val(this.defaultValue);
- }
- });
- };
- }(jQuery));
Add Comment
Please, Sign In to add comment