如果没有控制台错误,Bootstrap表单验证无效

Cha*_*chi 7 html javascript jquery dom twitter-bootstrap

这是简单的形式.

这是JS代码:

$(document).ready(function() {
  $('#ledgerHolderjHolderFormEdit').bootstrapValidator({
    feedbackIcons: {
      valid: 'glyphicon glyphicon-ok',
      invalid: 'glyphicon glyphicon-remove',
      validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
      JH_INIT: {
        validators: {
          notEmpty: {
            message: "'First Name' is required."
          },
          regexp: {
            regexp: /^07[a-zA-Z0-9.,:;!-@#\$%\^\&*\)\(+=_-`~><|].+$/,
            message: "'Mobile Number' must only start with '07'."
          },
          stringLength: {
            min: 5,
            max: 30,
            message: "'First Name' must be more than 2 and less than 255 characters long."
          }
        }
      }
    }
  });
});
Run Code Online (Sandbox Code Playgroud)

控制台中没有显示错误,也找不到错误.谁能帮我?

Cha*_*chi 8

找到解决方案

形式和js没有任何影响.问题是,我在'编辑功能'中写了html表单(使用jQuery附加html表单).并且在验证函数后写入另一个函数.这就是原因.

经过多方努力,我在"编辑功能"中编写了验证.问题解决了.