簡體   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