James
James

Reputation: 2610

How to make the input control remember the value I have inputed

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

Answers (1)

Exception
Exception

Reputation: 8389

Try this way
With this plugin you can make it work.
Here are some of available API

  1. 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.

  2. 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.

  3. 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

Related Questions