I have a part that loads all the common links and styles in my head, and I use setScript on other pages for local scripts. I want to add the following script, which is in my view / scripts after other scripts, but zf adds it first:
<? $this->headScript()->setScript('$(document).ready(function() { $("#birthdate").datepicker(); });', $type = 'text/javascript') ?>
which leads to the following code:
<script type="text/javascript"> $(document).ready(function() { $("#birthdate").datepicker(); }); </script> <script type="text/javascript" src="/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="/js/jquery.dcmegamenu.1.3.3.min.js"></script> <script type="text/javascript" src="/js/jquery.hoverIntent.minified.js"></script> <script type="text/javascript" src="/js/jquery-ui-1.8.16.custom.min.js"></script>
but I want:
<script type="text/javascript" src="/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="/js/jquery.dcmegamenu.1.3.3.min.js"></script> <script type="text/javascript" src="/js/jquery.hoverIntent.minified.js"></script> <script type="text/javascript" src="/js/jquery-ui-1.8.16.custom.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#birthdate").datepicker(); }); </script>
source share