0

I'm trying to add datepicker in my modal window, but I had no success so far.

<script src="/js/jquery-1.6.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
    $("#date_start").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '/images/pick_date.png' });
});
</script>

<div><?php echo $this->form->date_start ?></div> //this form element has id="date_start"

Any ideas?

Vlada
  • 15
  • 1
  • 5
  • what does "no success" mean? What did you get? And, what does "modal window" mean? Did you mean modal dialog? Did you remember to include jquery-ui javascript file? – William Niu Oct 05 '11 at 11:43
  • I think this is a duplicate of the following: [rouble-with-jquery-dialog-and-datepicker-plugins](http://stackoverflow.com/questions/715677/trouble-with-jquery-dialog-and-datepicker-plugins) – Mark Oct 05 '11 at 11:43
  • "no success" mean absolutely nothing happens. Modal dialog, you're right. Yes, I included jquery-ui javascript file – Vlada Oct 05 '11 at 11:59
  • nothing, it's like datepicker doesn't exist – Vlada Oct 05 '11 at 16:08

1 Answers1

0

nothing, it's like datepicker doesn't exist

Then probably your code runs before the DOM is ready. Fix things so it runs after the DOM is ready. jQuery can help you do this.

Peter Wone
  • 17,965
  • 12
  • 82
  • 134