?
Solved

Jquery datepicker implementation

Posted on 2011-03-18
1
Medium Priority
?
402 Views
Last Modified: 2012-05-11
Hi experts,

Ive got the datepicker working on this page: http://www.deans-place.co.uk/site1/date2.php

Im now trying to implement it into my form. So far ive added the includes for the datepicker to my existing form header so it looks like this....

<link type="text/css" href="themes/custom/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script src="includes/jquery.js"></script>
<script src="includes/ui.core.js"></script>
<script src="includes/ui.datepicker.js"></script>

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="includes/js/jquery.form.js"></script>
 
<script>

  $(document).ready(function() {
    $('#myForm').ajaxForm({
      target: '#showdata',
      success: function() {
        $('#showdata').fadeIn('slow');
      }
    });
  });
</script>

I now need to add the following code for the datepicker into the header. But when I add it the form stops working, any idea why? ...

<script>
$(function() {
$("#datepicker").datepicker({dateFormat: 'dd-mm-yy'});
});
</script>


Many Thanks,
Dean.
0
Comment
Question by:deanlee17
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
chuckalicious earned 2000 total points
ID: 35169352
Couple of things, first of all it looks like you're loading jQuery twice in the head though jQuery.js and jquery-latest.js

So once you've sorted that, your datepicker code does not need to be in a function.

You want the following:

$(document).ready(function() {

    $('#myForm').ajaxForm({
      target: '#showdata',
      success: function() {
        $('#showdata').fadeIn('slow');
      }
    });
$("#datepicker").datepicker({dateFormat: 'dd-mm-yy'});
  });

Should be as easy as that
0

Featured Post

Certified OpenStack Administrator Course

We just refreshed our COA course based on the Newton exam.  With 14 labs, this course goes over the different OpenStack services that are part of the certification: Dashboard, Identity Service, Image Service, Networking, Compute, Object Storage, Block Storage, and Orchestration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question