Guest User

Untitled

a guest
Dec 11th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1.  
  2. <script>
  3. // This adds 'placeholder' to the items listed in the jQuery .support object.
  4. jQuery(function() {
  5. jQuery.support.placeholder = false;
  6. test = document.createElement('input');
  7. if('placeholder' in test) jQuery.support.placeholder = true;
  8. });
  9. // This adds placeholder support to browsers that wouldn't otherwise support it.
  10. $(function() {
  11. if(!$.support.placeholder) {
  12. var active = document.activeElement;
  13. $(':text').focus(function () {
  14. if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
  15. $(this).val('').removeClass('hasPlaceholder');
  16. }
  17. }).blur(function () {
  18. if ($(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
  19. $(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');
  20. }
  21. });
  22. $(':text').blur();
  23. $(active).focus();
  24. $('form:eq(0)').submit(function () {
  25. $(':text.hasPlaceholder').val('');
  26. });
  27. }
  28. });
  29. </script>
  30.  
  31. </head>
  32. <body>
  33.  
  34. <input type="text" placeholder="wachtwoord!" style="width:300px;" />
  35.  
  36. </body>
  37. </html>
Add Comment
Please, Sign In to add comment