日期:2014-05-16  浏览次数:20346 次

jQuery 验证 为空时点击按钮IE8下不提示,输入数据在删除提示,google、ff浏览器正常,ie8咋么解决?
<!DOCTYPE html>

<html>
<head>
    <title>Index</title>
    <script src="@Url.Content("~/Scripts/jquery-1.8.0.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>

    <script type="text/javascript">
        function Validate() {
            if ($("form").valid()) {
                $("form").trigger("submit");
            }
        }
    </script>
</head>
<body>
    <div>
        <form>
            <label>用户民:</label>
            <input type="text" id="txtUser" name="txtUser" data-val="true" data-val-required="请输入用户名!" />
            <span data-valmsg-for="txtUser"></span>
        </form>
    </div>
    <input type="button" value="验证" onclick="Validate();" />
</body>
</html>

------解决方案--------------------
$(function(){
    var vali = {
        rules: {
            yonghu: {
                txtUser: true
            }
            
        }
    };
    $("form).validate(vali);
});
这样试试
------解决方案--------------------
引用:
Quote: 引用:

$(function(){
    va