Created
          July 14, 2015 03:19 
        
      - 
      
 - 
        
Save banderson623/cf01d64ae4a072890c35 to your computer and use it in GitHub Desktop.  
    Color and Text/Hex Field Pairing
  
        
  
    
      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
    
  
  
    
  | <div class="color-container"> | |
| <input type="text" name="hex" class="text-value" /> | |
| <input type="color" name="color" class="color-value" /> | |
| </div> | |
| <script type="text/javascript"> | |
| $('.color-container').on('change keyup', 'input[type="text"], input[type="color"]', | |
| function(){ | |
| var $this = $(this); | |
| if($this.attr('type') === 'color'){ | |
| $this.siblings('input[type="text"]').val($this.val()); | |
| } else { | |
| $this.siblings('input[type="color"]').val($this.val()); | |
| } | |
| }); | |
| </script> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
You can see this running at http://jsfiddle.net/banderson623/8hpogmwj/1/