Reputation: 1950
I have a textbox for user to enter positive integer. User enters a lot of entries many times. Overtime, textbox has list of previous entries, when you start typing something similar to previous entry. Sometimes, user accidentally select those previous entries. I know this one of browser's features.
Is there anyway to clear these previous entries from javascript, or jQuery?
So, I'm thinking of using textbox (password mode) then unmask it with Javascript or jQuery. I think browser won't keep anything if textbox is for password.
How can I unmask textbox password with Javascript or jQuery if it's the right approach for this problem?
What I'm doing is to clear the history of the textbox I have on an ASPX page.
Thank you.
Upvotes: 1
Views: 2704
Reputation: 79
You can't change the "type" attribute. There is some jquery plugins for that.
This one is very simple to use: http://unwrongest.com/projects/show-password/
Upvotes: 1
Reputation: 14888
Do you want to change the input type from password
to text
?
$('#yourField').attr('type', 'text')
Upvotes: 2
Reputation: 2421
If you have a master page, you can turn form autocomplete off like in the child page that you have that Textbox control on like this:
On page load event:
>Me.Form.Attributes.Add("autocomplete", "off")
Also add this attribute to your Textbox AutoCompleteType="Disabled"
Upvotes: 2
Reputation: 18344
I think you are talking about the autocomplete feature - the browser gives a list of entries entered previously.
If you don't want it, then simple use autocomplete="off"
. There is no need of javascript (and therefore jquery)
Autocomplete can be turned off for one particular field or for an entire form.
<form name="form1" id="form1" method="post" autocomplete="off">
<input type="text" name="text1" autocomplete="off">
But remember: This is a very useful feature, before turning it off make sure that it is essential to turn it off
Upvotes: 5