Change color of date < today

I want to change the color of the text in a field (exp_date) if the date is < today

frappe.ui.form.on(“Your Doctype Name”,
{

exp_date: function(frm){
	color_it(frm);
}

});

var color_it = function(frm)
{
var today = frappe.datetime.get_today();

if(frm.doc.exp_date < today)
	{
        document.querySelectorAll("[data-fieldname='exp_date']")[1].style.color="red";
	}

}