This kind of question may be asked several times but my problem is different.
I have a Text field and its declaration is like this
<input type="text" autoplete="off" name="email" id="email" value="Email" onfocus="if (this.value=='Email') this.value='';" onblur="if (this.value=='') this.value='Email';" onkeyup="javascript:chk_email(this.value);" onblur="javascript:chk_email(this.value);" />
When I enter a word a drop down of all similar cache email is ing below the textbox.
I try with adding autoplete="off"
in input
tag still it is ing.
I also write this javascript but no luck.
<script type="text/javascript">
document.getElementById("email").reset();
</script>
Is there any way I can remove this drop down of cache email from my form. I only want to remove only this textbox's cache not the whole forms.
This kind of question may be asked several times but my problem is different.
I have a Text field and its declaration is like this
<input type="text" autoplete="off" name="email" id="email" value="Email" onfocus="if (this.value=='Email') this.value='';" onblur="if (this.value=='') this.value='Email';" onkeyup="javascript:chk_email(this.value);" onblur="javascript:chk_email(this.value);" />
When I enter a word a drop down of all similar cache email is ing below the textbox.
I try with adding autoplete="off"
in input
tag still it is ing.
I also write this javascript but no luck.
<script type="text/javascript">
document.getElementById("email").reset();
</script>
Is there any way I can remove this drop down of cache email from my form. I only want to remove only this textbox's cache not the whole forms.
Share Improve this question asked Sep 26, 2012 at 6:30 Yogesh SutharYogesh Suthar 30.5k18 gold badges73 silver badges100 bronze badges9 Answers
Reset to default 5autoplete="off"
is not valid markup with XHTML Transitional, which is a mon DOCTYPE
try
jQuery
$("#email").attr("autoplete","off");
Javascript
document.getElementById("email").setAttribute("autoplete","off");
Let me know if this help or not.
How about using <textarea>
instead of <input>
. It will work sure as <textarea>
won't show drop-down. See code
<textarea autoplete="off" name="email" id="email" onfocus="if (this.value=='Email') this.value='';" onblur="if (this.value=='') this.value='Email';" onkeyup="javascript:chk_email(this.value);" onblur="javascript:chk_email(this.value);" rows="1" >
value here</textarea>
Instead Of adding autoplete="off"
to input tag try adding that to form tag
<form name="myform" method="post" autoplete="off">
Instead of input type text use input type email
<input type="email" autoplete="off" name="email" id="email" value="Email" onfocus="if (this.value=='Email') this.value='';" onblur="if (this.value=='') this.value='Email';" onkeyup="javascript:chk_email(this.value);" onblur="javascript:chk_email(this.value);" />
You could use JavaScript to change the name of the input element in question.
document.getElementById("email").name = Math.random();
This will give the element a pletely new name each time and the browser wont recognise it as an email input thus wont display the cache.
This has worked for me in the past.
Try adding the following variables:
// Older browsers
onCopy=”return false”
onPaste=”return false”
onDrag=”return false”
onDrop=”return false”
autoplete="off" // HTML 5
The autplete=off options is not standard, but you can use it in most browsers and it should work, but not as an input attribute, rather the form it belongs to:
<form ... autoplete="off">
# your inputs
</form>
Although that is more a client issue rather than an application one. More on this here:
https://developer.mozilla/en-US/docs/How_to_Turn_Off_Form_Autopletion
declare document type as
<!DOCTYPE html>
since autoplete=”off”
is not valid markup with XHTML Transitional,
which is a mon DOCTYPE
The problem was with cache, so i cleared whole cache from browser and used the html which i was using
<input type="text" autoplete="off" name="email" id="email" value="Email" onfocus="if (this.value=='Email') this.value='';" onblur="if (this.value=='') this.value='Email';" onkeyup="javascript:chk_email(this.value);" onblur="javascript:chk_email(this.value);" />