Skip to content Skip to sidebar Skip to footer

Jquery Ui Datepicker Date Range

I am using the jQuery UI plugin with the Datepicker function, to set a date range. The example provided on their page (http://jqueryui.com/demos/datepicker/date-range.html) sets t

Solution 1:

To check to see if your element has a class, do this:

if ($(this).is('.start_date')) {

or

if ($(this).hasClass('start_date')) {

The name of the property of DOM elements is "className", not "class" (confusingly). Also it makes your code fragile to check for the class name to be equal to some string, because you never know if you might want to add another class (like "required" for example). Thus you should always check either with jQuery or with some other method that accounts for the possibility that an object can have many classes.

Also you may want to check out the Filament Group's date range picker for jQuery.

Post a Comment for "Jquery Ui Datepicker Date Range"