Created
          May 11, 2010 16:45 
        
      - 
      
 - 
        
Save jlbruno/397528 to your computer and use it in GitHub Desktop.  
    A jQuery 'plugin' to allow you to log to the console the current jQuery object
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | jQuery.fn.clog = function(msg) { | |
| var txt = msg ? msg : ""; | |
| if (console && typeof console.log != "undefined") { | |
| console.log('%o ', this, txt); | |
| } | |
| return this; | |
| } | |
| /* | |
| * use .clog() in the middle of your chain to make sure you have the | |
| * proper object before you continue. it will log the current jquery | |
| * object to the console. ex: | |
| * $('.selector').find('children').clog().addClass('css'); | |
| * you can pass it a msg to log out as well .clog('this should be children') | |
| */ | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment