Sign in

Sign up

Change form label color when in focus/active

MDB SupportCategory: MDB jQueryChange form label color when in focus/active
bobdempsey83 Pro User asked 3 weeks ago in MDB pro, version:4.5.0

Hey everyone, I have an md-form that I’d like to change the color of an input label when the cursor enters it. I’ve tried input:active & input:focus to change color, but it’s not working for me.

Any suggestions?

Thanks! 🙂

2 Answers
Marta Szymanska answered 2 weeks ago


try this code:

.md-form input[type=text]:focus:not([readonly]) + label { color: #CC0000; }



bobdempsey83 Pro User replied 2 weeks ago

Hey thanks so much Maria.

That code worked for my name & email inputs, but not the textarea.

Do you have anything that will work for the textarea?


Marta Szymanska answered 1 week ago


I don’t have a solution for textarea now. In MDB, we don’t change label color of textarea on active.



Marta Szymanska replied 4 days ago

You’re welcome.

bobdempsey83 Pro User replied 5 days ago

Hey here’s the working example:

Change form color & label on focus

Change input color on focus:

Thanks again for the help! 🙂

Marta Szymanska replied 1 week ago

I’ve just got the idea for textarea label. You need to add a new class to .md-form wrapper of textarea. Try this: {
color: #4285F4;

bobdempsey83 Pro User replied 1 week ago

Ok thanks very much!