Text Color in Dropdown Select List in Editor Form?
Text Color in Dropdown Select List in Editor Form?
hamlet1964
Posts: 43Questions: 8Answers: 1
I'm trying to figure out how to change the default text color (black) that appears in an Editor Form dropdown list. Does anyone have any ideas?
Here's some CSS I've used to successfully change the form's input controls (but not the dropdown list):
div.DTE_Field_Input input {
border: solid 1px #035096;
color: #035096;
}
div.DTE_Field_InputControl select {
border: solid 1px #035096;
color: #035096;
}
And here's the JS referencing the specific field:
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
ajax: "controllers/upload-many.php",
table: "#example",
fields: [ {
label: "category",
name: "stuff.category",
type: "select"
},
Thanks in advance.
This discussion has been closed.
Answers
Have you tried this?
Also see here: https://stackoverflow.com/questions/12836227/change-select-box-option-background-color
Thanks for the feedback. Unfortunately, the text color for the dropdown options remains black, despite these changes.
How are you using your CSS? Inside an event handler? I guess that would be required. I am doing certain Editor form manipulations myself as well. I always do them on "open" which works fine.
https://editor.datatables.net/reference/event/open
Thanks for sharing. The CSS is defined, in the example I provided, in the style section of my code at the very beginning.
That might not work because the DOM elements your CSS tries to manipulate might not exist at the time of code execution. Again, I would use an event. On “open“ or on “opened“ should work.
Since I'm a newbie, would it be possible to provide a snippet?
Well, there is example code in the event reference documentation ... but here is more:
This shows you what you can do with events such as "opened" or "open"
Your case is a lot easier:
Thanks. When I insert that I get an error message, however.
Uncaught SyntaxError: Unexpected identifier
Post a test case as per the forum rules please. Alternatively post your entire javascript code.
Is your Editor called "editor"? If not you need to call it the way your Editor is called when using the event handler.
Here's the script. Thanks for your patience!
... and the full error message please ...
file_cabinet.html:61 Uncaught SyntaxError: Unexpected identifier
Ok, that's a CSS problem ... I would use your browser's inspector and stack overflow to resolve this. You should find something there quickly for sure. That's how I am doing it anyway for stuff I don't really care about ... CSS is certainly none of my favorite topics ...
Since you are a newbie let me share my experience as a not so long ago newbie:
Why am I using JavaScript and jQuery, Data Tables, MySQL and PHP? Simple: All of the four still are the most popular platforms / tools for front end programming, tables with dynamic content, relational database and server processing! And you can resolve any issue by simple googling, using SO or this forum! That's why I refrained from using other, more “modern“ technologies when I got restarted with coding in 2016. When you are on your own this is the most important thing to bear in mind in my humble opinion: where can I find a solution when I am stuck and can I do it quickly without waiting for an answer ... I think I never asked a question on SO, but found the answers to many of my questions and responded to many ...
Many thanks for the feedback, much appreciated. I'll keep investigating!