2

I'm using jQueryUI to add a datepicker to a textfield. It all works fine, but because of this i'm not able to type any text into the textfield. I can only add a date through the datepicker.

But i want users to be able to also enter things like NOW in the textfield. But currently entering manual text is blocked as you can see in this example fiddle: http://jsfiddle.net/Kugzd/

Is there anyway to change this behavior?

0

2 Answers 2

7

Just add constrainInput: false to your datepicker option

$(function() {
    $('.date').datepicker({
        constrainInput: false
    });
});

Check the documentation

Demo: http://jsfiddle.net/Kugzd/2/

2

In addition to using constraintInput option (as noted by another answer), consider combining the datepicker along with Date.js library, which allows you to work with words and expressions such as today, tomorrow, next Tuesday and turn them into dates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.