Is it possible to have jQuery UI autocomplete for div and datepicker content ads working in harmony?

In the forum post How to make jquery autocomplete to work with the content DIV instead of the INPUT, TEXTAREA fields. We see how autocomplete works on the content element of the div, but when combined with datepicker, datepicker simply does not fill in the input field.

As you can see in this jsFiddle demo: http://jsfiddle.net/xvnaA/

Anyone have wise ideas on how to fix this?

+3
source share
1 answer

Instead of overriding $.fn.val you can override it like this:

 (function ($) { var original = $.fn.val; $.fn.val = function() { if ($(this).is('[contenteditable]')) { return $.fn.text.apply(this, arguments); }; return original.apply(this, arguments); }; })(jQuery); 

See http://jsfiddle.net/xvnaA/27/

+9
source

All Articles