While scottmartin's suggestion will work, it's not necessarily recommended for storing passwords since information stored in localStorage or cookies is insecure. Instead, it's better to trigger the "remember my password" functionality that's built-in for basically all browsers these days.

While scottmartin's suggestion will work, it's not necessarily recommended for storing passwords since information stored in localStorage or cookies is insecure. Instead, it's better to trigger the "remember my password" functionality that's built-in for basically all browsers these days.