Can someone help me write a function for showing a line of text (preferably by showing a css class) for a jquery datepicker after someone has clicked a date?
The not
You might be able to validate it using date.js, it has a fluent API which makes it very easy to express your conditions.
Example code might be:
var enteredDate = $("#delivery_date").prop("value");
var parsed = Date.parse(enteredDate); 
var start = Date.today();
var end = Date.today().add(21).days(); 
if (!parsed.between(start, end)) {
    alert("Date is valid");
} else {
    alert("Date is not valid");
}
Test plunker