My text inputs seem not to remember values that have been typed before. For example, many websites that I don't even have an account on, but have, for example entered my email address before (buying a train ticket as a "guest") give me a sort of dropdown with email addresses I've used in the past. Yet my form does not do this. It obliges me to type it out completely every time. It seems to be the opposite of this question...
I have simple inputs like <input type="text" id="firstName" placeholder="First name" />
And they are submitted with simple a jQuery Ajax post. Something like this. However the Ajax isn't working on jsbin on that example, I just show it to demonstrate my basic structure. Is there a jQuery plugin for this? Is there a way I can control this seemingly browser-driven behavior?
The reset() method resets the values of all elements in a form (same as clicking the Reset button). Tip: Use the submit() method to submit the form.
In most browsers, you can make your browser display values previously entered in input fields by giving a name to the input. For example:
<input type="text" id="firstName" placeholder="First name" name="firstName" >
If the field has no name attribute, the browser won't show suggestions.
Also check if javascript prevents the default action on submit.
I had the same problem. For me, it was when developing in ASP.NET MVC. Anyway, the solution I had to make was a combination of things:
Having the name attribute defined in my input tags
Having autocomplete="on"
in my input tags
Changing the button tag to be a type="submit"
tag
Enclosing all my input controls in a <form>
tag
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With