How to add text to blank dropdown selection

Hi,

I have a drop down that displays county names that is set up like this.

image

I am trying to add text to the blank selection at the top of the drop down. When selected, the associated repeating group shows all counties as wanted but I would like to name it “All Counties”

I tried the Custom Blank Options for Dropdowns plugin without success. I currently have the following java script workflow running but still no success.

Thanks in advance for any help!

Scott

Hello, your code seems right, check the element and the trigger starts the js.
Look my exemple, where I resolved the same problem

Hi, Thanks for the response. There’s some progress but the selection is blank when I first navigate to the page. If I navigate away and then return, the drop down displays All Counties at the top which is what I want. Any idea why it isn’t there when the page first loads? Debugger says the js is running.

Man, I saw that once, but I don’t remember it well. Try changing the “page is loaded” trigger to “conditional is true” (use the visible dropdown menu)

Hi,

I got it to work by changing the workflow to run every time the State dropdown value was changed. Thanks for your help!

Unless you are dynamically rendering the dropdown (such as dropdowns in repeating groups), all you need to do is run the script once after the dropdown has rendered.

For example if it is visible on page load, just run it after the page loads above fold or entirely.

You can use a Do When Event that runs the script when that dropdown is visible. Add a small delay (pause action) if it still doesn’t find the element.

It’s just how running browser scripts work. It needs to be able to find the element during execution. You can of course use an observer but kinda overkill if it’s just one element.