cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Change colour of asterisk in sap.m.label required=true

buch
Employee
Employee
0 Kudos

Hi experts,


I am just wondering if you know how to change the colour of the star/asterisk that comes with sap.m.label. I want to change only a certain amount of the asterisks so I am thinking of using custom data to differentiate them apart. But my issue is that how do I actually change the colour of the asterisk?

code for label:

<Label text="{i18n>title}" required="true">

<customData>

<core:CustomData key="CE" value="blue" writeToDom="true" />

</customData>

</Label>

corresponding ccs file:

[data-CE="blue"]{ 
   color: blue !important;
}


However, that just changed the colour of the label text and not the asterisk

here is the screenshot of the inspecting element

I know the classes that asterisks are using: " .sapMLabel.sapMLabelRequired .sapMLabelColonAndRequired::after "


Does anyone know how can I apply the colour to the right place?


Thank you,

Buch


Accepted Solutions (1)

Accepted Solutions (1)

buch
Employee
Employee
0 Kudos

Got it working

using the id with addclass to the element

let languageLabel = this.getView().byId("languageLabel");

$($(languageLabel.getDomRef()).children()[1]).addClass("blue");

Answers (0)