Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Change label color using Javascript

Former Member
0 Kudos
362

Hello All,

I am working on an application.I have developed frontend using Xml now i want to change the label color on click of button can any1 please help me with this.

i tried the code

onclick : fuction()

{

var l = this.getView().byId("lbl");

document.getElementById("l").setColor = 'Blue';

}

but its not working please help me with this.

Thanks in advance

1 REPLY 1

Private_Member_15166
Active Contributor
0 Kudos
159

Are you working with SAPUI5??

This is not the right approach.

var l = this.getView().byId("lbl");

l.addStyleClass("LabelStyle");



Here define your custom CSS.

See this document.


And this is not the right space to ask such questions.

Post your query here.