When I faced the same problem, I came across two methods to solve it.
Example using javascript
<input onfocus="this.type='password'" onblur="if (this.value.length <= 0) { this.type = 'text' } else { }" id="password"/>
Example using html (by creating a temporary text box just above the password field and hide it)
<input type="text" style="display:none;">
<input id="password" type="password">