1/** 2 * Load this file with your form. 3 * Add to any form input you want to disable browser autocomplete for: rel="disableAutoFill" readonly 4 * Or on a kojs input, add: data-bind="disableAutoFill:true" readonly 5 6 */ 7 8$.fn.disableAutoFill = function () { 9 this.each(function () { 10 var el = $(this); 11 if (!el.data('disableAutofill')) { 12 el.data('disableAutofill', true); 13 // autocomplete="randomString" disables autocomplete on some browser versions 14 el.prop('autocomplete', 'randomString'); 15 el.data('disableAutofill-focusing', false); 16 17 // readonly should disable autocomplete on the rest 18 el.on('focus touchstart', function () { 19 if (!el.data('disableAutofill-focusing')) { 20 el.data('disableAutofill-focusing', true); 21 //timeout fixes firefox needing double click on inputs 22 setTimeout(function () { 23 if (el.prop('readonly')) { 24 el.prop('readonly', false); 25 26 //blur and refocus fixes mobile keyboard, makes it appear on safari 27 el.blur(); 28 el.focus(); 29 el.data('disableAutofill-focusing', false); 30 } 31 }); 32 } 33 }); 34 el.on('blur', function () { 35 if (!el.data('disableAutofill-focusing')) { 36 el.prop('readonly', true); 37 } 38 }); 39 } 40 }); 41}; 42$('input[rel="disableAutoFill"]').disableAutoFill();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.