繁体   English   中英

如何在 html 表单中自动填写 @gmail.com

[英]how to auto fill like @gmail.com in html form

i have a form where every email is registered with @scoops.com but every time i have to enter @scoops.com i want that user just enter email name and @scoops.com auto fill and it will also show at the end of input场地? 这是我的代码

<div class="form-group" autocomplete="off">
        <label>Email <span style="opacity: 0.5; font-style: italic;">(Required)</span></label>
        <input autocomplete="nope" type="text" name="email" id="email"  class="form-control input-lg" 
        placeholder="Enter Email" name="name" required=""/>
        <span id="error_email"></span>
        @if($errors->has('email'))
        <div class="alert alert-danger">
        {{ $errors->first('email') }}
        </div>
        @endif
      </div>

我想要这样的东西

我想要这样的东西

由于您使用 Bootstrap:尝试将您的邮件输入包装到一个 Inputgroup 中。 然后 append 邮件结尾(通过对您的输入进行分组)。 我也不确定 'autocomplete="nope"' 是否是该属性的 state。 如果没有意味着没有,你应该考虑“关闭”。

<div class="input-group">
    <input autocomplete="off" type="text" name="email" id="email"  class="form-control input-lg" placeholder="Enter Email" name="name" required=""/>
     <div class="input-group-append">
         <span class="input-group-text">@scoops.com</span>
     </div>
</div>

除了上面所说的之外,您可以执行以下代码之类的操作来提交用户键入的值,并附加您想要的任何文本:

<input id="myInput">
<button onclick="submit(document.getElementById('myInput').value)"></button>

<script>
  function submit(inputValue) {
    var submittedValue = inputValue + "@scoops.com"

    // insert here the code (like a POST request) to send the 'submittedValue' variable to wherever you want
  }
</script>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM