How to add email icon in ui action button

viraj4
Giga Contributor

How to add email icon in UI action button??

1 ACCEPTED SOLUTION

Got it , below script works for me in my PDI

function onLoad() {

transformButton('email_incident', '#FF0000', 'white', 'icon-mail');

}

function transformButton (buttonID, buttonBackgroundColor, buttonTextColor, buttonIconName)  {
try{
//Find the button(s) by ID and change the background color
$$('button[id=' + buttonID + ']').each(function(elmt) {
elmt.style.backgroundColor = buttonBackgroundColor;
if(buttonTextColor){
elmt.style.color = buttonTextColor;
}
if(buttonIconName){
elmt.addClassName(buttonIconName);
//Add some spacing between the icon and button label
elmt.innerHTML = ' ' + elmt.innerHTML;
}
});
}catch(e){}
}

View solution in original post

23 REPLIES 23

Hi 

You wrote the function wrong, copy this - 

function transformButton(buttonID, buttonBackgroundColor, buttonTextColor, buttonIconName) {
try{
//Find the button(s) by ID and change the background color
$$('button[id=' + buttonID + ']').each(function(elmt) {
elmt.style.backgroundColor = buttonBackgroundColor;
if(buttonTextColor){
elmt.style.color = buttonTextColor;
}
if(buttonIconName){
elmt.addClassName(buttonIconName);
//Add some spacing between the icon and button label
elmt.innerHTML = ' ' + elmt.innerHTML;
}
});
}catch(e){}
}

Chavan AP
Kilo Sage

Please elaborate the requirement a little

Glad I could help! If this solved your issue, please mark it as Helpful and Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****

viraj4
Giga Contributor

Can someone help me on this issue?

Thanks in Advance

Viraj

VigneshMC
Mega Sage

Check "Isolate Script" field is made false when you try this code.

Thanks

viraj4
Giga Contributor

Hi

I am using Kingston so this option is out of context here i guess.

Thanks

Viraj