0

I am using dat.gui in a webapp that needs a userid / password. Like normal webapps, I would like to mask the password to '*******' as the user is typing in the password.

I am aware about the onChange event on a text field that will return me the current value as the text is modified by user; but unable to figure out how to replace the typed-in values to '****''

1 Answers1

0

This may be a little late, but the following works pretty well.

var obj = { text: 'Password' };

var passwordField = gui.add(obj, 'text');

var inputElement = passwordField.domElement.firstChild;
var style = getComputedStyle(inputElement, null).cssText;

inputElement.type = "password";
inputElement.style.cssText = style;
Grinde
  • 326
  • 1
  • 11