简体   繁体   中英

Jquery fails to hide div in IE10 running in IE7 document and browser mode

I have written a small jQuery script that queries the url to see if it contains certain text (in this case a PL/SQL generated parameter and value). If so, the script hides a div in the page content and adjusts the adjacent divs to fill the space left by the now absent div. My current issue is that for some reason the script isn't working in IE7 despite working in all other browsers.

    <script type="text/javascript">
      $(document).ready(function () {
        if(window.location.href.indexOf("p_ccp_path=APPLY") != -1){
          $(".page-content-right").hide();
          $("#right-col").css("width","60%");
          $("#icams-inserted").css("width","100%");
        }
      });
    </script>

I'm using a localised version of jQuery 1.10.2 and the page on which this error is occurring can be found here:

http://tinyurl.com/jqueryError

Any ideas?

Additional:

I've checked Firebug and there are no errors. However, when I check the IE developer tool it comes up with the following error:

  SCRIPT3: Member not found
  jquery.min.js, line 5 character 8860

Additional2:

From some of the comments, it appears that this may be an issue with the IE10 render as IE7 mode. I'm going to test this on a Vanilla version of IE7 on virtual box to make sure that this is the case.

It would appear that this is a bug with IE10 itself rather than there actually being any errors in my code. Testing a stock version of IE7 on a remote machine showed that the script does indeed work on IE7 without a hitch.

To ensure that the issue does not persist if users are running their browser in compatability mode, I have used the following meta tag:

     <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />

This ensures that the most recent version of IE standards mode is used when running in IE compatibility mode through the use of the 'Edge' specification.

Credit to @MythThrazz for the suggestion that it may be an issue with the IE10 compatability mode.

Googling for the error code points to this url: http://bugs.jquery.com/ticket/12577

The error may not related with the part of the code you've posted.

I suspect the problem is .indexof() .

It is supposed to be camel-case, so it should be .indexOf() (with a capital O ). Javascript cares about this sort of thing, so I'm surprised if that would work in any browser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM