簡體   English   中英

Bootstrap 輸入標簽應用所需的驗證

[英]Bootstrap input tags apply required validation

我正在使用引導標簽輸入https://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/並成功實施。 我只是想讓它成為必填字段,以便每個用戶提交帶有技術標簽的表單。

<div class="col-lg-6">
 <label class="">Primary Skills (Note: Add comma separated) <span class="text-danger">*</span></label>
 <input class="form-control" type="text" id="primaryskill" name="seeker_primary_skills" required>
 <b class="tooltip tooltip-top-right">This is a required</b>
</div>

這是此操作的屏幕截圖。

在此處輸入圖片說明

檢查表單提交的回報

<form onsubmit="return checktag()">

Javascript/Jquery 代碼

function checktag(){
   if($("#primaryskill").val() == ''){
      alert("Tags Required"); //Here you can simple alert or change input css with 
      border red with msg with the help of jquery
      return false;
   }else{
        return true; 
   }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM