Skip to content

Instantly share code, notes, and snippets.

@pixelbart
Created April 19, 2017 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixelbart/c23e2f39e467f0a230386f4d10abb0a0 to your computer and use it in GitHub Desktop.
Save pixelbart/c23e2f39e467f0a230386f4d10abb0a0 to your computer and use it in GitHub Desktop.
A simple color picker for/with html and jquery
<label class="kevin-color">
<input type="text" name="kevin_color" value="" />
<input type="color" name="kevin_color" value="" />
</label>
<script>
jQuery('.kevin-color input[type="color"]').on( 'change', function() {
var ValColor = jQuery(this).val();
jQuery('.kevin-color').find('input[type="text"]').val(ValColor);
});
jQuery('.kevin-color input[type="text"]').on( 'change', function() {
var ValColor = jQuery(this).val();
jQuery('.kevin-color').find('input[type="color"]').val(ValColor);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment