I am having troubles for positioning a span with the watermark text on top of an input. The code using GWT+uibinder looks like that:
http://jsfiddle.net/camposcarlos/dMzL4/
and transformed into html looks like that:
instead of having the span overlapped on top of the input field by floating it to the left:
|----------------------------------|
| |------------||--||
| |passwd ||Go||
| |------------||--||
| |
|----------------------------------|
I get it after the input
|----------------------------------|
| |------------| |--||
| | |passwd|Go||
| |------------| |--||
| |
|----------------------------------|
or in the next line if I try to position the span relative to the width of the input
|----------------------------------|
| |------------||--||
| | ||Go||
| |------------||--||
| passwd |
|----------------------------------|
Any ideas on how to solve it? Thanks in advance.
Check this fiddle, it's using absolute positioning. http://jsfiddle.net/ajMWd/1/
edit Just another version doing the same thing http://jsfiddle.net/ajMWd/2/
If your problem is now that you want to display default text in a password box, but the password default text is unreadable, you will need to change your password input to be a normal text input before the user enters data.
Than, in your JavaScript, you can use the focus event to change it back to being a password-type input.
Try something like this:
I have been able to solve it using a nice solution from here. The trick was to tag the container with a relative position style and the passwordbox and its span with absolute tags. It works with no need of specifying any position! (although I haven't tried with IE yet) http://jsfiddle.net/ajMWd/4/