Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
151
rated 0 times [  154] [ 3]  / answers: 1 / hits: 42294  / 12 Years ago, tue, may 15, 2012, 12:00:00

To have a working datepicker on a field, I have to put this script inside my element



$( function() {
$( #date_datepicker ).datepicker( { dateFormat: yy-mm-dd } );
});


Removing the $( function() { makes the datepicker not work.



So does it mean that the $( function() { is the same as $(document).ready?



I'm trying to optimize my javascript codes so knowing this might help.


More From » jquery

 Answers
15

See the extract below from http://api.jquery.com/ready/




All three of the following syntaxes are equivalent:




  • $(document).ready(handler)

  • $().ready(handler) (this is not recommended)

  • $(handler)



[#85575] Monday, May 14, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rianna

Total Points: 67
Total Questions: 113
Total Answers: 113

Location: French Polynesia
Member since Tue, Jul 7, 2020
4 Years ago
;