Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Edit custom field placeholder › Reply To: Edit custom field placeholder
June 10, 2021 at 3:23 pm
#33606
Keymaster
Might be possible:
add_action('wp_footer', 'wp_footer_change_filter_input_placeholder', 9999);
function wp_footer_change_filter_input_placeholder() {
?>
<script>
(function(){
let fields = {
"field-name1": "My placeholder text1",
"field-name2": "My placeholder text2"
};
setTimeout(function() {
Object.keys(fields).forEach(function(k){
let text = fields[k];
document.querySelectorAll('fieldset.asp_custom_f input[name*='+k+']').forEach(function(el){
el.placeholder = text;
});
});
}, 100);
}())
</script>
<?php
}
In the code change the fields variable -> on the left side are the custom field keys, on the right side the placeholder for that field.