<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Looks like the JavaScript isn't actually being loaded. You can confirm this with Firefox developer tools or equivalent for your browser of choice. Most likely this is a path issue; what directory did you put the jQuery UI source in?<br>
<br></div>I use jQuery UI in a Dancer2 app. I used the dancer2 command line utility to set up the directory structure, so I have:<br><br></div>myapp/<br></div><div>    lib/<br></div><div>        <a href="http://myapp.pm">myapp.pm</a><br>
</div>    public/<br></div>        javascripts/<br></div>            jquery.js<br></div>            jquery-ui.js<br></div><div>            myapp.js<br></div>    views/<br></div>        <a href="http://index.tt">index.tt</a><br>
</div>        layouts/<br></div>            <a href="http://main.tt">main.tt</a><br><div><div><div><div>    ...<br><br></div><div>I load all my JavaScript in the main layout (views/layouts/<a href="http://main.tt">main.tt</a>), something like this:<br>
<br><span style="font-family:courier new,monospace"><!DOCTYPE html><br><html><br>  <head><br>    <link rel="stylesheet" href="//<a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.min.css">ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.min.css</a>" /><br>
    <link rel="stylesheet" href="[% request.uri_base %]/css/style.css" /><br><br>    <!-- Get jQuery and jQuery UI from Google's CDN if available, with local copy as a fallback --><br>    <script src="//<a href="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js</a>" type="text/javascript"></script><br>
    <script src="//<a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js">ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js</a>" type = "text/javascript"></script><br>
    <script type="text/javascript">/* <![CDATA[ */<br>        !window.jQuery && document.write('<script type="text/javascript" src="[% request.uri_base %]/javascripts/jquery.js"><\/script>')<br>
    /* ]]> */</script><br>    <script type="text/javascript">/* <![CDATA[ */<br>        !window.jQuery.ui && document.write('<script type="text/javascript" src="[% request.uri_base %]/javascripts/jquery-ui.js"><\/script>')<br>
    /* ]]> */</script><br><br>    <script src="[% request.uri_base %]/javascripts/myapp.js" type="text/javascript"></script><br>  </head><br>  <body><br>      [% content %]<br>
  </body><br></html></span><br><br></div><div>Two things to note: first, I use the template parameter 'request.uri_base' to get an absolute URL to the base of the application (which points to the public/ directory); second, I only use my local copy of jQuery if I fail to get it from Google's CDN.<br>
<br></div><div>I create an HTML <input> element for my datepicker in views/<a href="http://index.tt">index.tt</a>:<br><br><span style="font-family:courier new,monospace"><input type="text" id="datepicker"></span><br>
<br></div><div>And the JavaScript to create the datepicker is in public/javascripts/myapp.js, something like:<br><pre><div class=""><div class=""><span style="font-family:courier new,monospace"><code>$(<span class="">function</span>() {</code></span></div>
</div><div class=""><div class=""><span style="font-family:courier new,monospace"><code>    $('#datepicker').datepicker({<br>        dateFormat: $.datepicker.ISO_8601,<br>        maxDate: 0,<br>        changeMonth: true,<br>
        changeYear: true<br>    });<br></code></span></div></div><div class=""><div class=""><span style="font-family:courier new,monospace"><code>});</code></span></div></div></pre>(I haven't tested the above but it's essentially what my app does)<br>
</div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 11, 2014 at 7:59 AM, Sullivan Beck <span dir="ltr"><<a href="mailto:sbeck@cpan.org" target="_blank">sbeck@cpan.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've using Dancer 1.3115 on OpenSuSE 13.1.  I've downloaded jquery 1.11.1 and the datepick plugin from <a href="http://keith-wood.name/datepick.html" target="_blank">http://keith-wood.name/<u></u>datepick.html</a>.<br>

<br>
I took the simplest test script from the datepick home page (and stripped it down to a single popup calendar -- that's the functionality I want) and put it in a very simple Dancer script. Unfortunately, although the HTML produced is correct, the Dancer script isn't working.<br>

<br>
When I run the dancer script and point my browser at it, I see a text box asking for a date.  If I click in the box, no calendar pops up to select the date.<br>
<br>
If I view the page source and copy the html into a dancer2.html file and open that file up in my browser and it works great.  I see the same page, and clicking in the box pops up the calendar.<br>
<br>
I'm a fairly recent user of Dancer, but I'm really liking it and want to use it for a project but I really need the datepicker to work.<br>
<br>
Any suggestions?<br>
<br>
I'm attaching the <a href="http://dancer2.pl" target="_blank">dancer2.pl</a> script and the HTML it generates. My setup is that I have <a href="http://dancer2.pl" target="_blank">dancer2.pl</a> and dancer2.html in a directory and a subdirectory jquery containing both jquery and the datepicker plugin (both completely unmodified).<br>

<br>
<br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>