I am using the jquery datepicker on a number of text input fields in my forms. I typically bind it to the input(s) as follows:
$(function() {
$("#date_due").datepicker();
});
In certain circumstances, the id of the field that I am referencing may not be an input field, but I still want to use the same ID and I dont want the datepicker to be available.
I have tried the following, but it doesnt seem to work (i.e. the datepicker does not appear at all):
$(function() {
$("#date_due :input").datepicker();
});
Or, put another way, I only want the datepicker to be used if the field is a form text input.