I am supposed to use a jquery plugin to fill in some text fields. My professor is almost completely unresponsive about it when I ask him for help. Using the pickadate Jquery plugin, add a date picker and time picker to two <input> fields.

<!doctype html>
<html>

   <head>
      <title>Exercise 11A</title>

      <script type = "text/javascript" 
         src = "http://plugins.jquery.com/pickadate/"></script>

      <script type = "text/javascript" language = "javascript">

         $('.datepicker').pickadate()
      </script>

   </head>

   <body onload = 'pickadate'>
        Birth Date: <input type="text" id="birthdate" readonly><br/>
        Birth Time: <input type="text" id="birthtime" readonly>
   </body>

</html>

This is just one that I've tried, but he will not tell me how to actually include the plugin to be used in the code. Everything I've looked up has been vague, so now I'm reaching out to the place where people actually teach me things. I tried saving the plugin to my machine first, and tried linking to it's path from there, but the same result. When I inspect the elements, the page cannot load the resource. I'm just looking for some help with syntax I suppose.

Recommended Answers

All 5 Replies

My first peek is that your script source on line 8 looks incorrect. Just for a test I went to that URL and it pulled up the site and not the .js content. ( https://plugins.jquery.com/pickadate/ )

So just to look a little deeper I downloaded it and got a .zip file with the needed .js, documentation and what looks like a demo.

My advice is to try the demo first.

Okay, I see that...how do I reference the plugin once I have it downloaded? I tried to place it in a desktop folder and reference the path on line 8 to that but it doesn't seem to work.

Where depends on your web server setup. I can't know what you are using and folk use dozens of web servers of which I am a master of none. I know the basics but you have to be a near master of the web server you plan to use.

I just want to utilize the pickadate jquery plugin to fill in the text boxes within the body. I just don't understand how to use the plugins

Then use their demo from the zip file first. I took the .zip from the URL you gave up top in your code, the extracted that to a desktop folder and opened index.htm Datepicker did work. I read the docs and it said "Make sure to also include the legacy.js file along for the oldie browsers." which you did not.

It appears you tried to use this without looking at the demo or example or docs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.