Examples/Demo
agjCalendar is designed to be easily integrated into existing projects quickly and without compatibility issues or any other conflicts. Because it’s a jQuery plugin you will first need to include an HTML reference to the jQuery Javascript library if you don’t already have one. From there, simply add HTML references to jquery.agjCalendar.js and jquery.agjCalendar.css to start using the agjCalendar plugin.
<!-- Reference to the jQuery Javascript library -->
<script type="text/javascript" src="//code.jquery.com/jquery-3.7.1.min.js"></script>
<!-- Reference to the agjCalendar jQuery plugin -->
<script type="text/javascript" src="//agjCalendar.agjjQuery.org/source/agjCalendar/jquery.agjCalendar.min.js"></script>
<!-- Reference to the agjCalendar CSS stylesheet -->
<style type="text/css">@import "//agjCalendar.agjjQuery.org/source/agjCalendar/jquery.agjCalendar.min.css";</style>
All of the examples below have interactive demos for you to try out.
Example One: Basic Integration
To initialize a basic integration simply select a jQuery element and call its agjCalendar()
function. Alternatively you can call the $.agjCalendar()
function directly and pass your element selector using the dateSelector
option.
HTML Source & Javascript Source
HTML Source & Javascript Source
Example Two: Dropdowns and Expander
Instead of a single text input, you can set the inputType
option to dropdown
to allow users to select dates using two dropdowns set by the monthSelector
and daySelector
options. You can also integrate an optional expander element to allow the calendar to show up on click using the expanderElement
option. The expanderElement
can be used with both text and dropdown integrations.
HTML Source & Javascript Source
Example Three: Minimum, Maximum, Default and Excluded Dates
You can specify a minimum and/or maximum date by using the minimumDate
and/or maximumDate
options. Simply pass a string in the format YYYY-MM-DD
or a date object to control which dates can be selected via the calendar. Further, you can choose either a default date to be prefilled using the defaultDate
option with a YYYY-MM-DD
formatted string, a date object or blank
along with the allowBlankDates
option set to true
. We also allow you to pass an array of dates that users will not be able to select using the excludeDates
option.
HTML Source & Javascript Source
HTML Source & Javascript Source
HTML Source & Javascript Source
HTML Source & Javascript Source
Example Four: Formatting and Display Options
There are other formatting and display choices for your integration. You can use the calendarCount
option to choose between a single, double or triple calendar. You can use the calendarSize
option to choose between a small, medium or large display. You can use the dateFormat
option to choose any date format. You can set the startWeekOnMonday
option to true
to show weeks starting with Monday on the calendar. You can use the dayNameFormat
option to choose between short, abbreviated or full day of week names. You can use the calendarDisplay
option to choose between inline
, modal
and full
displays but we recommend only using modal
and full
on touch devices along with an expander element.
HTML Source & Javascript Source
HTML Source & Javascript Source
HTML Source & Javascript Source
HTML Source & Javascript Source
HTML Source & Javascript Source
HTML Source & Javascript Source
Example Five: Date Ranges
Instead of being limited to a single date, you can set the allowRange
option to true
to enable date ranges and allow a user to select two dates. You can further control the date range by using the minimumRange
, maximumRange
, defaultRange
and autoSetEndDate
options which are all optional. Text and dropdown integrations both support ranges.
HTML Source & Javascript Source
HTML Source & Javascript Source
HTML Source & Javascript Source
Example Six: Existing/Original Values
If there is an existing value on the text or dropdown elements, it will be preserved once the integration is initialized. With a text input such as <input value="02/01/2000" … />
the date will be preserved regardless of if it is valid or not. With a dropdown such as <select … ><option value="2000-02" selected="selected">February 2000</option>…
the date will be preserved if an option exists with a matching value (2000-02
in the case of the example) after the integration has been initialized.
HTML Source & Javascript Source
HTML Source & Javascript Source
Example Seven: Included and Custom Themes
If you want to style your agjCalendar to matching your branding you can tap into on of our eight included themes. They are red
, orange
, yellow
, green
, cyan
, blue
, purple
& pink
. You can also use your own theme name which must begin with custom-
. You will need to add custom stylings to your CSS stylesheet to integration a custom theme, the custom-xxx
styles are included on the documentation website but not the plugin. There are more details on the themes page including a custom theme generator.
HTML Source & Javascript Source
HTML Source & Javascript Source
Example Eight: Disabling and Reinitializing Integrations
If you want to disable or change an integration you can use the $.agjCalendar.disable()
function. If you want to disable the integration you can call the function. If you want to change an integration you can disable the integration by calling the function and then initialize a new integration.
HTML Source & Javascript Source
HTML Source & Javascript Source
HTML Source & Javascript Source
Example Nine: Languages and Custom Translations
The plugin has support for twenty languages as well as custom translations. To use one of the included languages pass 'en'
, 'ar'
, 'bn'
, 'de'
, 'es'
, 'fr'
, 'he'
, 'hi'
, 'it'
, 'ja'
, 'ko'
, 'mr'
, 'pa'
, 'pt'
, 'ru'
, 'te'
, 'tr'
, 'ur'
, 'vi'
or 'zh'
as the language
option. To use custom translations pass an object of translations as the translations
option. There are more details on the translations page.