Home > Web Front-end > JS Tutorial > BootStrap+Validator operates the verification function in JS

BootStrap+Validator operates the verification function in JS

php中世界最好的语言
Release: 2018-04-17 16:30:29
Original
1305 people have browsed it

This time I will bring you BootStrap ValidatorOperation verification function in JS, BootStrap Validator operating verification function in JSNotesThere are Which ones, the following are practical cases, let’s take a look.

This is the starting verification code

function initValidate() { 
<span style="white-space:pre"> </span>$('#detailform').bootstrapValidator({ 
<span style="white-space:pre">     </span>feedbackIcons : { 
<span style="white-space:pre">      </span>valid : 'glyphicon glyphicon-ok', 
<span style="white-space:pre">      </span>invalid : 'glyphicon glyphicon-remove', 
<span style="white-space:pre">      </span>validating : 'glyphicon glyphicon-refresh' 
<span style="white-space:pre">     </span>}, 
<span style="white-space:pre">     </span>fields : { 
<span style="white-space:pre">      </span>txPassword : { 
<span style="white-space:pre">       </span>validators : { 
<span style="white-space:pre">        </span>notEmpty : { 
<span style="white-space:pre">         </span>message : '交易密码不能为空' 
<span style="white-space:pre">        </span>}, 
<span style="white-space:pre">        </span>notSameAndContinuity : { 
<span style="white-space:pre">         </span>message : '密码必须为6位不相同、不连续的数字' 
<span style="white-space:pre">        </span>} 
<span style="white-space:pre">       </span>} 
<span style="white-space:pre">      </span>} 
<span style="white-space:pre">     </span>} 
<span style="white-space:pre">    </span>}); 
      };
Copy after login

Sometimes we need to add or remove

based on conditions Add with addFile, approvalMemo is the input name value

$("#detailform").bootstrapValidator("addField", "approvalMemo", { 
<span style="white-space:pre">   </span>validators: { 
<span style="white-space:pre">    </span>notEmpty : { 
<span style="white-space:pre">     </span>message : '审批意见不能为空' 
<span style="white-space:pre">    </span>} 
<span style="white-space:pre">   </span>} 
<span style="white-space:pre">  </span>}); 
$("#detailform").bootstrapValidator('removeField','approvalMemo');
Copy after login

Remove using removeFile.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

JS implements a simple 24-hour clock

How to deal with img tag memory leaks in IE

The above is the detailed content of BootStrap+Validator operates the verification function in JS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template