<style type="text/css" >
#label2{font-size: 12px; color: #868600;background-color:#808000}
.classDiv1{font-size: 12px; color: #808000; }
.classDiv2{font-size: 12px; color: #EEE000; }
</style>
panel11 = Ext.create('Ext.form.Panel', {
title: 'Field with Label',
border: true,
width: 400, bodyPadding: 10,
renderTo: Ext.getBody(),
layout: { type: 'hbox', align: 'middle' },
items: [
{ xtype: 'textfield', hideLabel: true, flex: 1 },
{ xtype: 'label',
cls: 'classDiv1',
itemId: 'label1',
text: 'My Awesome Field', margins: '0 0 0 10'
}, { xtype: 'label',
cls: 'classDiv2',
itemId: 'label2',
text: 'My Awesome Field', margins: '0 0 0 10'
}]
});
function SetLabelColor() {
var bb = panel11.getComponent('label1')
//alert(bb);
bb.removeCls('classDiv1');
bb.addCls('classDiv2');
}