JQuery Unobtrusive Validation in IE 7 Compatibility Mode causes “Member Not Found” Error in Page with Form

落爺英雄遲暮 提交于 2019-12-12 16:06:34

问题


Recently I noticed a JQuery error when viewing my site in Internet Explorer. The error is a "Member not found" error originating from the JQuery source. I noticed that the compatibility mode button was clicked-unclicking this fixed the error but I can't assume users of my site will be so obliging. Since then I have tested my site using the different compatibility modes and cannot seem to shake-off this error.

To re-create the error I trimmed a test page to the following

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=IE7">
        <script src="/content/scripts/jquery-1.9.1.js"></script>
        <script src="/content/scripts/jquery.validate.js"></script>
        <script src="/content/scripts/jquery.validate.unobtrusive.js"></script>
        <title>IE Compatibility Test</title>
    </head>
    <body>
        <form>
        </form>
    </body>
</html>

Note: I am using JQuery Validation version 1.11.1 and Microsoft JQuery Unobtrusive Validation version 2.0. When the page loads the "Member not found" error occurs. I've noticed that removing the form tag stops the error from occuring. I've also tried providing the form with a name and id but the error still occurs.

I have searched for this others experiencing this error but found nothing relevant. This leads me to believe that I am doing something wrong. I would like to get this problem fixed as I am concerned that a user of my site will select "Compatibility View" in IE and the site won't operate correctly.

What is it I am missing/has anyone else experienced this error?


回答1:


Are you using IE 10? If yes then changing to compatibility mode to IE 7 or 8 is a bug.

Please refer to JQuery Unobtrusive Validation Bug ticket # 12577

Use the following meta to ensure the latest rendering engine is used

<meta http-equiv="X-UA-Compatible" content="IE=edge">


来源:https://stackoverflow.com/questions/16013134/jquery-unobtrusive-validation-in-ie-7-compatibility-mode-causes-member-not-foun

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!