Show password button I'm developing a module and in the settings page I've inserted a text field to allow users to insert a key.

I thought to change this into a password field but I want to also create a Show password button or a checkbox. How could I implement this functionality?
Password Toggle is already doing something of this sort. Code is simple and straight

Its basically a JS to be added at the right time.

function password_toggle_add_js_and_css() {
  $path = drupal_get_path('module', 'password_toggle');
  drupal_add_js($path . '/password_toggle.js');
  drupal_add_css($path . '/password_toggle.css');
}


You can borrow the module's js code for your module.