X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/69191eddb9e4221d964a7e5b044ff7c5dfe38315..cb40f164b028883a2fc061307383d0aa98f8b609:/wolnelektury/static/js/dialogs.js?ds=sidebyside diff --git a/wolnelektury/static/js/dialogs.js b/wolnelektury/static/js/dialogs.js index 846331cdd..086a47d3d 100755 --- a/wolnelektury/static/js/dialogs.js +++ b/wolnelektury/static/js/dialogs.js @@ -150,6 +150,48 @@ }; + + // check placeholder browser support + if (!Modernizr.input.placeholder) + { + // set placeholder values + $(this).find('[placeholder]').each(function() + { + $(this).val( $(this).attr('placeholder') ).addClass('placeholder'); + }); + + // focus and blur of placeholders + $('[placeholder]').focus(function() + { + if ($(this).val() == $(this).attr('placeholder')) + { + $(this).val(''); + $(this).removeClass('placeholder'); + } + }).blur(function() + { + if ($(this).val() == '' || $(this).val() == $(this).attr('placeholder')) + { + $(this).val($(this).attr('placeholder')); + $(this).addClass('placeholder'); + } + }); + + // remove placeholders on submit + $('[placeholder]').closest('form').submit(function() + { + $(this).find('[placeholder]').each(function() + { + if ($(this).val() == $(this).attr('placeholder')) + { + $(this).val(''); + } + }) + }); + } + + + }); })(jQuery)