Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable autocomplete for all jquery datepicker inputs

Tags:

I want to disable autocomplete for all inputs using jquery ui datepicker without doing this to every input manually. How could be this done?

like image 794
Ibrahim Hussein Avatar asked May 04 '10 12:05

Ibrahim Hussein


People also ask

How to disable autocomplete in datepicker?

datepicker'). on('click', function(e) { e. preventDefault(); $(this). attr("autocomplete", "off"); });

How do I disable Datepicker?

To disable a datepicker in jQuery UI we will be using disable() method which is discussed below: jQuery UI disable() method is used to disable the datepicker. Parameters: This method does not accept any parameters.

What is Datepicker in JavaScript?

The JavaScript DatePicker (Calendar Picker) is a lightweight and mobile-friendly control that allows end users to enter or select a date value. It has month, year, and decade view options to quickly navigate to the desired date.


2 Answers

try this:

$('.datepicker').on('click', function(e) {    e.preventDefault();    $(this).attr("autocomplete", "off");   }); 

in anycase you have not mentioned in your question that this is coming from an ajax call!

like image 146
Luca Filosofi Avatar answered Oct 05 '22 12:10

Luca Filosofi


Try this:

<input type="text" name="field1" value="" autocomplete="off" /> 
like image 31
Makram Saleh Avatar answered Oct 05 '22 13:10

Makram Saleh