Issue with jQuery UI datepicker inside colorbox
I'm basically injecting raw HTML into colorbox's HTML property and calling the onComplete function to add datepicker. It works for inline, but not when using the HTML property. Is this an existing bug or is it an issue with the datepicker itself?
onComplete: function() {
$(".datebox").datepicker({
changeMonth: true,
changeYear: true,
...
I don't see any reason why they would behave differently. Can you post a simple demo of your issue with using the html property? I don't have the time at the moment to put together a test case.
Here's a simple demo of a datepicker on a colorbox. http://menacestudio.com/colorbox/ The datepicker works but the month and year selection doesn't.
I'm also using moment, backbone, underscore if that helps. Thanks!
I visited your page using Chrome on Mac and didn't experience any issues. I could change the month and year while Colorbox was open. Was this an issue with a particular browser? Also, try setting Colorbox's trapFocus property to false to see if that resolves the issue (I didn't have to do this, but it could be an issue with another browser).
I visited the page and found the following:
On FF 23.0.1: The month and year selects would not open and I could not select from them. I could pick a day and the arrows beside the month/year worked.
On Chrome 28.0.15: Everything seemed to work fine.
Thanks EleventyOne. I tried with FF and experienced that same issue. Then I set the trapFocus property to false and that seemed to resolve it.
Yup that worked! Thanks guys!
I got the same issue. I used an id as selector, but colorbox duplicate the whole html content and the id's too. So if I use $('#myid').doSomething() I got an error, because "myid" was duplicated. Thats the issus.
Use a better selector like $('#colorbox .myidasclass').doSomething() to solve the issue. The same problem is with class selector without the '#colorbox' as additional selector.