I want to disable autocomplete for all inputs using jquery ui datepicker without doing this for each input manually. How can I do that?
autocomplete
try the following:
$('.datepicker').on('click', function(e) { e.preventDefault(); $(this).attr("autocomplete", "off"); });
in any case, which you did not mention in your question, that this is an ajax call!
Try the following:
<input type="text" name="field1" value="" autocomplete="off" />
Assign the css class to your feeds, i.e. "datepicker" and then follow these steps:
$(".datepicker").attr("autocomplete", "off");
This works for me (it has been tested on Chrome v70.0.3538.110):
$("#dtpckr([readonly])").datepicker() .focus(function() { $(this).prop("autocomplete", "off"); // return false; });
This works great for me.
$("#autocmpldisablechk").click(function () { if (!$(this).is(":checked")) { // enable autocomplete $("#autocomplete").autocomplete({ disabled: false }); } else { // disable autocomplete $("#autocomplete").autocomplete({ disabled: true }); } });