Text color change for alert message

Hafsa1
Mega Sage

Is it possible to change some part of text's color shown using alert message in catalog client script? like

alert("If you choose category as personal laptop, then you have to attach <font color='red'>email approval from your manager</font> with this request.");

 

I want only "email approval from your manager" in red color and rest will be as standard one.

7 REPLIES 7

Hafsa1
Mega Sage

My requirement is I have a variable(type) of select type. When I select value as "personal laptop" for a particular catalog then the alert message should be shown. 

For this I have created a system ui> message where I have put the alert message with color for some text. This is fine.

Now on widget sc_cat_item, I want to show it. how to get the variable value and based on it show the alert?

Paul Curwen
Giga Sage

My advice. Stop using alert and use SweetAlert. 

 

It's freely available on Share and it's awesome:

https://developer.servicenow.com/app.do#!/share/contents/1320723_sweetalert_2?v=2&t=PRODUCT_DETAILS

 

Have a look at some examples here:

https://sweetalert2.github.io/

 

 

 

 

***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul

Hafsa1
Mega Sage

I used is catalog client script but it's not working

parent.swal("Any fool can use a <font color=\'red\'>computer</font>");