Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Color text in custom user meta search fields › Reply To: Color text in custom user meta search fields
May 15, 2019 at 8:15 am
#22652
Keymaster
Hi,
Maybe this variation would work better:
add_action('wp_footer', 'asp_custom_option_color');
function asp_custom_option_color() {
?>
<script>
jQuery(function($){
var color1 = '#aaa';
var color2 = '#000';
$('select').on('change', function(){
if ( $(this).prop('selectedIndex') == 0 ) {
$(this).css('cssText', 'color: ' + color1 + ' !important;');
} else {
$(this).css('cssText', 'color: ' + color2 + ' !important;');
}
});
});
</script>
<?php
}
and the css:
select {color: #aaa !important;}
option:not(first-child) {color:#000 !important;}
This may not work perfectly either, but I think it’s as close as it can possibly get.