Disable autocomplete via CSS

后端 未结 12 731
渐次进展
渐次进展 2020-12-13 05:18

Is it possible to use CSS to disable autocomplete on a form element (specifically a textfield)?

I use a tag library which does not permit the autocomplete element an

12条回答
  •  天命终不由人
    2020-12-13 06:02

    Thanks to @ahhmarr's solution I was able to solve the same problem in my Angular+ui-router environment, which I'll share here for whoever's interested.

    In my index.html I've added the following script:

    
    

    Then to cover state changes, I've added the following in my root controller:

    $rootScope.$on('$stateChangeStart', function() {
                    $timeout(function () {
                        $('input').attr('autocomplete', 'off');
                    }, 2000);
                });
    

    The timeouts are for the html to render before applying the jquery.

    If you find a better solution please let me know.

提交回复
热议问题