Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Jquery datepicker implementation

Posted on 2011-03-18
1
Medium Priority
?
403 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

618 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