How to Change Date range Dynamically in jQuery UI Datepicker

The jQuery UI Datepicker widget allows us to pick a date from the widget. It has various options by using them you can customize it.

With minDate and maxDate options you can specify the date range. It restricts the users to pick a date within the specified range.

The value of minDate and maxDate options values can also be defined dynamically at the runtime.

In this tutorial, I show how you can dynamically set date range in jQuery UI datepicker.

How to Change Date range Dynamically in jQuery UI Datepicker

Read more

Insert Image in Dropdown lists with jQuery

In HTML it is not possible to add an element to the dropdown list. You need to customize it.

For example –

If you try to add a search box in an <option> or add a country flag image following with country name. When you run it you don’t see any changes in the dropdown.

This can simply be done with the jQuery plugins which adds more features to the simple dropdown element.

In this tutorial, I show how you can insert an image in the dropdown with select2 and Easyautocomplete plugins.

Insert Image in Dropdown lists with jQuery

Read more

How to add !important to CSS property with jQuery

In CSS !important is used to increase the priority of a CSS property. This ignores the overriding properties.

In jQuery, you can use the css() method to manipulate style property of the selector but this doesn’t allow to set !important to property.

For example –

$('#txt').css('width', '100px !important');

The above code doesn’t work when you run it.

In this tutorial, I show how you can add !important to CSS property with jQuery.

How to add !important to CSS property with jQuery

Read more