**关闭。**此题需要debugging details。目前不接受答复。
编辑问题以包括desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将帮助其他人回答这个问题。
5天前关闭。
Improve this question
enter image description here
我想加上“. domainX.com“来输入。在每一个按键移动一个字符的域名。
我试着给它设置样式,试着使用占位符,但我无法将占位符设置为不消失。
1条答案
按热度按时间vmdwslir1#
好吧,你可以用html表单做这样的事情,只要你的输入文本很短,否则它会被隔开:
所以你的html是这样的:
你的Javascript像这样:
和CSS一样,你可能要调整的位置有点左上角右等取决于字体
这是因为输入字段允许你将输入值onchange传递给一个函数,这样函数就可以将它添加到一个隐藏的span中,作为“. www.example.com“的分隔符domainX.com,然后这个分隔符将匹配输入中文本的宽度,这样后缀就在正确的位置,样式只是将文本移动到inputField后面,这样它就可以看起来像它的一部分。希望这有帮助!