Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- // This adds 'placeholder' to the items listed in the jQuery .support object.
- jQuery(function() {
- jQuery.support.placeholder = false;
- test = document.createElement('input');
- if('placeholder' in test) jQuery.support.placeholder = true;
- });
- // This adds placeholder support to browsers that wouldn't otherwise support it.
- $(function() {
- if(!$.support.placeholder) {
- var active = document.activeElement;
- $(':text').focus(function () {
- if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
- $(this).val('').removeClass('hasPlaceholder');
- }
- }).blur(function () {
- if ($(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
- $(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');
- }
- });
- $(':text').blur();
- $(active).focus();
- $('form:eq(0)').submit(function () {
- $(':text.hasPlaceholder').val('');
- });
- }
- });
- </script>
- </head>
- <body>
- <input type="text" placeholder="wachtwoord!" style="width:300px;" />
- </body>
- </html>
Add Comment
Please, Sign In to add comment