Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. (function($) {
  2.  
  3. $.fn.creofocus = function(options) {
  4. this.each(function(){
  5. alert($(this).attr('id'));
  6. });
  7.  
  8. this.on('focus', function(){
  9.  
  10. var input = $(this),
  11. val = input.val();
  12.  
  13. if (!val) {
  14. input.removeClass('empty').addClass('focused');
  15. } else {
  16. input.removeClass('filled').addClass('focused');
  17. }
  18.  
  19.  
  20. });
  21.  
  22. this.on('blur', function(){
  23. var input = $(this),
  24. val = input.val();
  25.  
  26. if (!val) {
  27. input.addClass('empty').removeClass('focused');
  28. } else {
  29. input.addClass('filled').removeClass('focused');
  30. }
  31. });
  32. return this;
  33. };
  34. }(jQuery));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement