In my Bootstrap (v4.5.3) form, the select options appear differently in Firefox as shown in the image below:
https://i.sstatic.net/3suke.png
Upon form submission, I have JavaScript code for validation which checks if an option other than "-- Select an Option --" has been chosen. If this condition is not met, the JavaScript stops the form submission and highlights the unselected option by changing its border color to red:
ELEMENT.style.borderColor = "red";
However, this change in styling causes the select element to lose its default Bootstrap appearance, making it look like the image below:
https://i.sstatic.net/9mPSN.png
The bottom select remains unchanged for comparison purposes.
I am wondering if there is a different way to highlight the option without affecting the Bootstrap styles. Should I be using a specific CSS class instead of modifying the borderColor property?
Edit: For example, visit https://jsfiddle.net/xbqucoLp/