【问题标题】:Bootstrap form validation not working without console error引导表单验证在没有控制台错误的情况下无法正常工作
【发布时间】:2018-05-15 10:57:55
【问题描述】:

这是Simple form

这是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."
          }
        }
      }
    }
  });
});

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

【问题讨论】:

  • 请将您的 HTML 复制并粘贴到问题中,就像您对 JS 代码所做的那样。代码图像几乎没用
  • 您已经回答了这个问题。那为什么要开始赏金呢?
  • 你的意思是在 6 个月前解决的问题上吹 100 个代表点?

标签: javascript jquery html twitter-bootstrap dom


【解决方案1】:

找到解决方案

form和js没有效果。问题是,我在“编辑函数”中编写了 html 表单(使用 jQuery 附加 html 表单)。并且在验证函数之后写在另一个函数中。这就是原因。

经过多次努力,我在“编辑功能”中编写了验证。问题解决了。

【讨论】:

    【解决方案2】:

    确保您已正确包含 JQuery

    【讨论】:

      猜你喜欢
      • 2014-04-13
      • 2018-02-21
      • 2013-12-25
      • 2012-11-18
      • 1970-01-01
      • 2013-03-04
      • 2020-02-25
      相关资源
      最近更新 更多