Skip to content Skip to sidebar Skip to footer

Disable Autocomplete For All Jquery Datepicker Inputs

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

Solution 1:

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!

Solution 2:

Try this:

<inputtype="text" name="field1" value="" autocomplete="off" />

Solution 3:

Assign a css class to your datepickers, i.e. "datepicker", then do the following:

$(".datepicker").attr("autocomplete", "off");

Solution 4:

This works for me (It was tested on Chrome v70.0.3538.110):

            $("#dtpckr([readonly])").datepicker()
            .focus(function() {
                $(this).prop("autocomplete", "off");
                //              return false;
            });

Solution 5:

This works for me perfectly.

      $("#autocmpldisablechk").click(function () {

        if (!$(this).is(":checked")) { // enable autocomplete

            $("#autocomplete").autocomplete({
                disabled: false
            });

        }
        else { // disable autocomplete
            $("#autocomplete").autocomplete({
                disabled: true
            });

        }
    });

Post a Comment for "Disable Autocomplete For All Jquery Datepicker Inputs"