Satch3000
Satch3000

Reputation: 49422

Javascript document load bug

I have the code below in which I've added 1 alert at the start and one at the end.

I get the first alert but the last alert never pops up.

Can anyone see why ?

Here is the code:

<script language="javascript">
    $(document).ready(function() {
      alert('start');  
        var month = getURLParameter('month') - 1; //-1 cause javascript months start in 0
   var currentYear = getURLParameter('year');
   var defaultDate = new Date(currentYear, month, 1); //Set to first day of the month
   $("#date").datepicker({ defaultDate: defaultDate });
  alert('end');

    });

</script>

Thanks

Upvotes: 2

Views: 494

Answers (1)

No Results Found
No Results Found

Reputation: 102864

It's most likely that getURLParameter is not defined or there is an error with it.

It could be that datepicker() is not available either.

This works in the jsfiddle demo with a placeholder function for getURLParameter and jquery UI loaded:

http://jsfiddle.net/wesley_murch/bwJGS/

Upvotes: 2

Related Questions