Here the scenario:
I want to apply a datepicker on a input field in a form.
When clicking a link a colorbox will open containing the form.
Somehow the datepicker doesn't work, so I searched the internet.
I was confused by this post datepicker inside a thickbox where the following statement was made:
JavaScript/jQuery is not working inside of ColorBox.
It confused me because other people seem to have worked it out.
I'll show the code of the colorbox call:
<script type="text/javascript">
$(document).ready(function() {
$(".customer").colorbox(
{
transition:'fade',
width:'750',
speed:'500',
height:'400',
iframe:true
});
});
</script>
The colorbox opens successfully although my error console says there is a } missing after the first }); occurrence.
The code for the datepicker:
<script type="text/javascript">$(document).ready(function() {
$('.datepick').datepicker({
changeYear:true,
yearRange:'c-65:c+0',
changeMonth:true
});
$('.datepick').datepicker($.datepicker.regional['nl']);});</script>
This code does work somewhere else on my website where it is not located in a colorbox.
What I have tried:
My question(s):
UPDATE
Solution: I made a stupid mistake :P...
Yet I found the answers on my first question, which may be of some value.
Does your loaded iframe contain the datepicker instantiation code?
My assumption is this:
class="customer"
iframe:true
)The easiest thing to do is to move the datepicker code to the onready function of the customer
page.