On Mar 13, 11:02 pm, "[email protected]"
<[email protected]> wrote:
> Hello everyone, I'm new so maybe this question is dumb but I cant seem
> to find how to display in the input box today'sdatewhen the page
> loads withdatepicker. If there is another way to do it please let me
> know. So far Ive been working with the demos so this is what I have so
> far as the function call:
>
> <script type="text/javascript">
>         $(function() {
>
>                 $('#datepicker').datepicker({
>                         numberOfMonths: 2,
>                         showButtonPanel: true,
>                         dateFormat: 'yy-mm-dd'
>                 });
>         });
>         </script>

I don't think the datepicker widget provides this functionality.
Someone correct me if I'm wrong.

This will set the date onload to todays date if there isn't already a
value set for the field.

        $(document).ready(function() {
            $("#date").datepicker();

            if ($("#date").val() === "") {
                $("#date").val(getDate())
            }
        });
        function getDate() {
            var date = new Date()
            var year = date.getFullYear()
            var month = date.getMonth()
            var day = date.getDay()
            var today = month + "/" + day + "/" + year

            return today
        }




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to