Reputation: 2610
In a login form, when I click submit button, if the submit is failed, the page will refresh and the content which I have inputed have gone, how to make the control remember the value I have tested and represent in the control.
Thanks in advance!
Upvotes: 1
Views: 820
Reputation: 8389
Try this way
With this plugin you can make it work.
Here are some of available API
Set the value of a form field or the HTML of an element to a cookie named
after the field's/element's name or id attribute
$('#username').cookify();
The value of the field, or HTML of the element, with id "username" is set to a cookie named after the name or id attribute of that field/element. If a radio or checkbox and it's checked, the value will be set.
Fill a field's value, or an element's innerHTML with the value of a cookie
$('#username').cookieFill();
Set the value of the input, or HTML of the element, with id, 'username', to the value of a cookie by the same name. If a radio or checkbox and it is checked, the cookie will be set. If not checked, the cookie will be deleted.
Bind an input to the cookies library
$('#username').cookieBind();
Fills the field or element with id, 'username', with the cookie named the same and sets the field's/element's change event to fire cookify() to update the cookie when the input value changes
Upvotes: 2