I'm trying to style the select input field's dropdown on a website so it follows the styleguide. I've managed to style the select field itself, but styling the dropdown turned out to be really tricky.
I added custom JavaScript that creates and injects custom HTML element that acts like a dropdown populated with custom elements that are options. It seems like everything works as expected until the form validation kicks in.
I made sure the real option's selected property is set to true, and its parent select field properties value and selectedIndex are also set accordingly. Inspecting the code in the developer console shows that both the value and selectedIndex are set, option's selected property is also set to true, but the form still throws an error.
So you've done it right by setting it up without adding the HubSpot CSS. But still - you can't technicaly modify the <option> dropdown. It's just not possible since - as I've said before - it will be rendered by the browser/os.
Here's an article which describes this topic in detail (and might help you)
here's the idea behind it: you create a clickable element(<a>/<button> ...) and by clicking on it it will trigger a (css) animation to display the list
I probably should've specific that I'm using hubspot form with Set as raw HTML form option checked, with shortcode generated by HubSpot plugin for WordPress. I don't need to create a custom dropdown, but rather to modify the one hubspot provides which I managed to do, but the validation doesn't seem to like my solution. Here's the JavaScript code I have written for this problem so you get the idea of what I'm trying to accomplish:
So you've done it right by setting it up without adding the HubSpot CSS. But still - you can't technicaly modify the <option> dropdown. It's just not possible since - as I've said before - it will be rendered by the browser/os.
Here's an article which describes this topic in detail (and might help you)