我想驗證表單域。 爲了得到這樣的結果: 如何更改引導驗證器圖標位置
我已經嘗試了簡單的解決方案,並給了我幾乎需要結果,但圖標放置不正確。我可以在這裏與JS
<div class="form-group row">
<label for="datum" class="col-md-2 col-form-label">Datum toolbox</label>
<div class="col-md-2 input-group has-warning" id="div_datum">
<input type="text" class="form-control datepicker" id="datum" name="datum" onclick="validate()"><span class="glyphicon glyphicon-warning-sign form-control-feedback" id="datum_status"></span><small class="form-text text-muted">Vul datum in</small>
</div>
</div>
任何建議更改圖標?
<div class="form-group row has-danger">
<label for="datum" class="col-md-2 col-form-label" for="datum2">Datum toolbox</label>
<div class="col-md-2 input-group has-warning" id="div_datum2" for="datum2">
<input type="text" class="form-control form-control-danger datepicker" id="datum2" name="datum2" onclick="validate()"><small class="form-text text-muted">Vul datum in</small>
</div>
</div>
我已經添加了以下文件: //cdnjs.cloudflare.com/ajax/libs/bootstrap-validator/0.4.5/css/bootstrapvalidator.min.css //cdnjs.cloudflare。 COM/AJAX /庫/引導,識別/ 0.4.5/JS/bootstrapvalidator.min.js
而這額外的JS代碼:
<script type="text/javascript">
$(document).ready(function() {
$('#tryitForm').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
datum2: {
validators: {
notEmpty: {
message: 'Please fill in'
}
}
},
},
});
});
</script>
user8175473圖標的建議編輯後正確放置雖錯過了右側sid上的圓角表單域的e。
<div class="form-group row">
<label for="datum" class="col-md-2 col-form-label">Datum toolbox</label>
<div class="col-md-2 input-group has-warning" id="div_datum">
<input type="text" class="form-control datepicker" id="datum" name="datum" onclick="validate()"><span class="glyphicon glyphicon-warning-sign form-control-feedback" id="datum_status"></span>
</div>
</div>
即使加上這對CSS沒有改變這一點。
.form-control{
-webkit-border-radius: 1;
-moz-border-radius: 1;
border-radius: 1;
}
謝謝你,看看我的結果編輯和角落裏剩下的小問題。有什麼建議麼? – Muiter
你的歡迎:)我沒有看到你的編輯。你可以在這裏添加鏈接嗎? – hasan