SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Noob, get started with jquery datepicker

    Noob here, know some JS, get the concept of jquery, but am in over my head getting started with using the datepicker.

    What is needed: need to get two datepickers to populate text fields as in a from date to an end date. These text field values will be used as parameters in querying a database. Want to use the datepicker to restrict user error. Had it working previously with a script from the web, but need to restrict date range, limit years to last five, etc. Looks like the datepicker found at http://docs.jquery.com/ui/datepicker would be just the ticket.

    However, when you look at the source it turns out that all is done linking to google. Further they are using 1.8, which I think is a reference to a jquery release and only 1.71 is available for downloading. Would like to set things up local.

    To start with, would just like to get datepicker to appear in a test page. Have downloaded 1.71 to my development directory locally, have a link to the script in the head, but don't want to play guess-a-step getting it going. Would like to get it working properly.

    Can someone point me in the right direction?

    Thanks
    ed

  2. #2
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    336
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If you want to use jQuery & jQuery UI locally, you need to download both:
    http://code.jquery.com/jquery-1.7.1.min.js
    http://jqueryui.com/download/jquery-....16.custom.zip (look in the js folder for the UI file)

    Then follow this guide to help you get started:
    http://jqueryui.com/demos/datepicker/

  3. #3
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okay now that I have a few more hours into it 1.8 is the jquery ui and it looks like 1.7 is the jquery library, even if I've yet to see it explicitly stated. Odd that on what is supposedly a jquery forum after 39 views someone couldn't point that out. WTF? Seriously.

    Be that as it may have also discovered that you do need both to run Datepicker 1.8.

    It also appears that that using jquery is really only slightly less involved than, say learning PHP. If not why was I able to download a nice selection of ebooks on the subject that average over 300 pages? Most of them are fatality flawed for beginners: they just gloss over the idea that you should go to the jquery site pull up the min version in a browser and save it as a .js file to a subdirectory of your www root directory. Mostly they say download the jquery file, (which while is technically what is happening but odd considering they don't say "go to my web site and download my home page (to your browser) to see new features...") Now that you have done that... Yeah, just skip material steps, that's working for me...

    So much for being quick or easy. Having dealt with a few php frameworks, some of which are w a a a a y more trouble than they are worth, am going to figure this out anyway.

    thanks y via con Dios muchacos

  4. #4
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by edziffel View Post
    okay now that I have a few more hours into it 1.8 is the jquery ui and it looks like 1.7 is the jquery library, even if I've yet to see it explicitly stated.
    It might be a little confusing when you're just starting out with using jQuery stuff, but the jQuery UI library is (basically) a set of widgets/tools that are built on top of the jQuery core library.

    jQuery UI has shot up a little bit faster in version numbers than the core library has, and it is currently at version 1.8.16 and the core jQuery library is at 1.7.1 at the moment.

    Quote Originally Posted by edziffel View Post
    So much for being quick or easy.
    Still a lot quicker than writing your own Datepicker

    If you want to use the script locally, there are 2 options available. You can download the actual files from the jQuery and jQuery UI sites or you can insert them directly from (for example) the Google CDN.

    I find that often loading jQuery UI locally has the benefit of using a customized version so you don't need to load all those widgets that you'll never use.
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •