toggle password field type

I plugged the above verbatim into a test page and it worked fine -- the entered text was obscured (*****) as I'd expect.

Are you seeing any errors in the console?

Wait a sec, what? I used your original example verbatim and it worked fine with FireFox 2.0/Linux.

Regardless, doing this requires JavaScript, since it happens in the client browser.

BTW, you could get away from duplicating fields in your markup with something like this:

<%= text_field 'user', 'pwd',     { :value => 'do something here',         :size => 30, :onfocus => "swap_field_type(this)" } %>

function swap_field_type(field) {      var parent = field.parentNode;      var replacement = document.createElement('input');      replacement.type = 'password';      replacement.id = field.id;      replacement.name = field.name;      parent.replaceChild(replacement,field);      replacement.focus(); }

FWIW,