Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

I want to implement onChange client script for changing the color of additional comment field based on checked and unchecked of checkbox. Please provide me the solution

dhanu3
Kilo Sage

I want to implement onChange client script for changing the color of additional comment field based on selection of checkbox. Please provide me the solution..

1 ACCEPTED SOLUTION

dhanu3
Kilo Sage

Hi,

Thank you for your help.

Now it is working with below code.

 

var c = document.getElementById("activity-stream-comments-textarea");

if (newValue == 'true') {
c.style.backgroundColor = '#FFFFE0';
}
else {
c.style.backgroundColor = '';
}

 

Thanks,

Dhanashree

View solution in original post

6 REPLIES 6

dhanu3
Kilo Sage

Hi Lauire,

 

I tried with the script you have provided but it is not working.

So I tried something like below. It is working for other fields but not for comments field which basically comes from 'task' table and which is journal input field.


if (newValue == 'true') {
var cTypeField = $('tablename.comments');

cTypeField.style.backgroundColor = 'yellow';
}
else {
cTypeField.style.backgroundColor = '';
}

 

Thanks,

Dhanashree

dhanu3
Kilo Sage

Hi,

Thank you for your help.

Now it is working with below code.

 

var c = document.getElementById("activity-stream-comments-textarea");

if (newValue == 'true') {
c.style.backgroundColor = '#FFFFE0';
}
else {
c.style.backgroundColor = '';
}

 

Thanks,

Dhanashree