I have written the following code which works, but im wondering can I make it any smaller.
$(document).ready(function ()
$('.datepickerTarget').datepicker({
onSelect: function (dateText, inst) {
$('#' + this.id).removeClass('watermark');
}
});
$('.datepickerTarget').datepicker("option", "dateFormat", "dd/mm/yy");
});
I guess im trying to understand what the line:
$('.datepickerTarget').datepicker("option", "dateFormat", "dd/mm/yy");
Is doing. Is this a constuctor? Where do I find what i can put in this line? Is it just a method? Not sure about the syntax.
Hope someone can help me understand so I can shorten this code make it a bit more slick…
You can set the date format when the object is constructed by passing it as a parameter to the “constructor” of the date time object.
If you are worried about size, look into JavaScript compression. I use the YUI compression algorithm.