Author Topic: JavaScript hates me lately  (Read 1359 times)

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
JavaScript hates me lately
« on: March 13, 2011, 10:13:34 PM »
Code: [Select]

$(function() {
$('#createdate').datepicker({
showButtonPanel: true,
            changeMonth: true,
changeYear: true,
            dateFormat: 'yy-mm-dd'
});
});

I'm using the jQuery datepicker.  I have this working in another location but the only difference is that I have 2 dates involved on the other one so there are 2 blocks like the above.  I just deleted the second block here since the second field doesn't exist and now it's throwing an error on the first line:

$ is not defined.

Which is total BS.  And the field name hasn't changed so WTF.

Reference: http://jqueryui.com/demos/datepicker/#multiple-calendars

Mike

  • Jackass In Charge
  • Posts: 11257
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
Re: JavaScript hates me lately
« Reply #1 on: March 13, 2011, 10:16:49 PM »
Check to make sure that the above block is after the jquery.js file is loaded

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: JavaScript hates me lately
« Reply #2 on: March 13, 2011, 10:42:11 PM »
Code: [Select]
<link type="text/css" href="js/jquery/development-bundle/themes/redmond/jquery.ui.all.css" rel="stylesheet" />
    <script type="text/javascript" src="js/jquery/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery/development-bundle/ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="js/jquery/development-bundle/ui/jquery.ui.datepicker.js"></script>

<script type="text/javascript">
$(function() {
$('#createdate').datepicker({
showButtonPanel: true,
            changeMonth: true,
changeYear: true,
            dateFormat: 'yy-mm-dd'
});
});
   
   
</script>

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: JavaScript hates me lately
« Reply #3 on: March 13, 2011, 11:01:57 PM »
OK, WTF.  It's working now.  Granted, I added another function in there to do something else, but surely that shouldn't impact it??  WTF?  I HATE YOU JAVASCRIPT!

hans

  • Guitar Addict
  • Jackass In Charge
  • Posts: 3523
  • Karma: +46/-18
Re: JavaScript hates me lately
« Reply #4 on: March 13, 2011, 11:53:01 PM »
You might have had a syntax error. Missing semi-colons cause random stuff like that sometimes.
This signature intentionally left blank.