Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define `autocomplete="off"` as a CSS style?

Tags:

html

css

To turn off autocompletion in HTML I use:

<input type="text" name="foo" autocomplete="off" />

But this forces me to specify autocomplete="off" in every input field of my application. Is it possible to define autocomplete="off" in a CSS style?

like image 520
ps0604 Avatar asked Jun 01 '16 11:06

ps0604


3 Answers

You can just apply it to the form tag.

like image 130
TeT Psy Avatar answered Oct 29 '22 16:10

TeT Psy


Using CSS you cannot achieve it. You can use client side script for example using Jquery

$('input').attr('autocomplete','off');

If you are not using Jquery or scripting language then you have to stick to HTML only.

As TeT Psy said you can apply it in form tag like

<form id="Form" runat="server" autocomplete="off">
like image 45
Rahul Tripathi Avatar answered Oct 29 '22 17:10

Rahul Tripathi


you can disable all the autocompletes using form

<form id="Form1" runat="server" autocomplete="off">
like image 30
Mahendra Kulkarni Avatar answered Oct 29 '22 16:10

Mahendra Kulkarni