如何在输入表单中附加不可删除的值?

时间:2017-02-14 18:32:23

标签: html input

我正在尝试做与此sign up form here完全相同的事情。他们已将其域名附加为不可删除的值,以允许用户创建子域文件夹。我想对以下输入做同样的事情:

 <input type="text" class="form-control inputlogin" name="subdomain_name" placeholder="Sub Domain" required="" value=""/> 

我找到了一种技术here,但我不打算附加前缀。该值必须与示例中的值相同。

2 个答案:

答案 0 :(得分:1)

这只是一个造型技巧。 input可以完全编辑或禁用(根本不可编辑)。没有办法解决这个问题。

在您链接的表单中执行的操作是一个技巧,其中“冻结”文本放在输入字段上,因此它看起来好像是实际输入标记的一部分,但事实并非如此。

Se my simple jsfiddle illustration。看看样式如何用于创造你想要的幻觉。

答案 1 :(得分:0)

以下是使用Bootstrap 3的示例:

Bootstrap 3 Sub-domain input

<div class="container">
  <div class="form-group">
    <div class="input-group">
    <input type="text" class="form-control" placeholder="Your sub-domaion here">
    <span class="input-group-addon" title="Type of Question">.our-domain.com</span>
    </div>
  </div>
</div>