Support

Account

Home Forums ACF PRO Customize select field's placeholder text

Solved

Customize select field's placeholder text

  • I am wondering if it’s possible to customize the select field’s placeholder text. I’m using it for U.S. states and would like it to be “Select State” instead of “- Select -“. Thanks!

  • Hello..

    There are probably many ways to tackle this. Not sure the best.

    You could dynamically create the options within the Select, giving you full control of the text of the ‘Select’ option. Just give it an empty or NULL value, so the validator won’t look at it as an *actual* choice.

    JQuery lets you change values/labels on-the-fly as well.

    Translation may be an approach.

    Let me know how you tackle it!

  • Thanks for the quick reply and for providing multiple suggestions, Keith! For now, I’m just going to go the jQuery route. I’ll update this post if a better solution arises.

    I realized that it wasn’t actually ‘placeholder’ text I wanted to change. It is, instead, the text content of the first select option. This is what I’m currently using:

    jQuery('select option:contains("- Select -")').text('State');

    Thanks again!

  • Another option to achieve this is to use ACF extended which then gives you advanced settings on fields including the select. One of the advanced options is ‘Advanced Validation’ where you can create rules for validating based on what the user has selected.. in this case if they selected the ‘Placeholder’ value, you can create a validation rule for that.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.