HTML5验证消息太过分了

时间:2016-10-31 12:16:47

标签: html5 html5-validation

 <div class="form-group">
        @Html.LabelFor(model => model.Title, htmlAttributes: new {@class = "control-label text-left "})
        <div class="">
            @Html.EditorFor(model => model.Title, new {htmlAttributes = new {id = "title", @class = "form-control checkIfFilled", placeholder = "F.eks. Front-end udvikler", required = "required"}}) 
            @Html.ValidationMessageFor(model => model.Title, "", new {@class = "text-danger"})
        </div>
    </div>

enter image description here

为什么它到目前为止?它看起来像是在#34; By&#34;字段。

这是checkIfFilled()函数

function checkIfFilled() {
        var allGood = [];

        $('.checkIfFilled').each(function (i, obj) {
            if ($(obj).val() == null || $(obj).val() == "") {
                allGood.push(false);
            }
            else {
                allGood.push(true);

            }
        });
        if(allGood.includes(false)){
            $('.checkFilled').prop("disabled", true);

        }
        else if ($('.panel-body').html() != null && $('.panel-body').html() != "<p><br></p>")
        {
            $('.checkFilled').prop("disabled", false);

        }
}

但是,删除它仍然不会影响消息。

0 个答案:

没有答案