//COMMENT FORM //change title conditionally for a certain post type function enym_comment_title($defaults) { // put…
Turn any text input field into a color picker with jQuery
I needed this functionality in forminator. Unfortunately this plugin does not support color picker inputs. But HTML5 and jQuery came to the rescue. Just specify the input with a class or ID and dump in this code snippet:
function enym_colorpicker() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
//CHANGE COLOR TYPE ON INPUT WITH CLASS colorpicker
jQuery(".colorpicker input").prop("type", "color");
});
</script>
<?php
}
add_action( 'wp_footer', 'enym_colorpicker' );
The result will look like this:
Comments (0)