Skip to main content

Hello, I want to change the color of the required field Asterisk (*). I want to to be a different color rather than the default color. Could anyone can help me with that??

Hi,

You’ll need a small piece of code to change the default color of the required field Asterisk (*)

First, make sure you have jQuery added to your page.

Now, put this code as a new script on the javascript tab with placement “Before Body End Tag

<script>
$("label").each(function() {
var text = $(this).text().replace(/\*/g, "<span class=\"asterisk\">*</span>");
$(this).html(text).find(".asterisk").css("color", "#0098db");
});
</script>

 

Change the color code inside the " " on the snippet to your liking and it should appear as the color of the required field Asterisk (*)

 

Live Example of swapping the default color of Asterisk on form fields


Wow! Thanks @Nayon

Just tried it out and it works perfectly. 😎


Wow! Thanks @Nayon

Just tried it out and it works perfectly. 😎

My pleasure, always happy to help 😃


Thanks a lot @Nayon!

It works perfectly. 

 


Thanks a lot @Nayon!

It works perfectly. 

 

Glad it helped


Reply