This is one more was to add css in your doctype field using jquerry
For read-only type of field it won’t work
frappe.ui.form.on('<doctype_name>', {
refresh : function(frm){
set_css(frm);
}
});
funtion set_css(frm){
document.querySelectorAll("[data-fieldname='<field_name>']")[1].style.color = 'green'
document.querySelectorAll("[data-fieldname='<field_name>']")[1].style.fontWeight = 'bold'
document.querySelectorAll("[data-fieldname='<field_name>']")[1].style.color = 'red'
document.querySelectorAll("[data-fieldname='<field_name>']")[1].style.fontWeight = 'bold'
}
example:
i have doctype name = Trello and i have to change the status field color
frappe.ui.form.on('Trello', {
refresh : function(frm){
set_css(frm);
}
});
funtion set_css(frm){
document.querySelectorAll("[data-fieldname='status']")[1].style.color = 'green'
document.querySelectorAll("[data-fieldname='status']")[1].style.fontWeight = 'bold'
}```