Click here to Skip to main content
15,029,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why is it that my JQuery code works well in Chrome and Firefox, but not in IE (version 9). I get a lot of undefined errors when opening my page in IE within the JQuery library code, and my self written code gives the following error: Microsoft runtime error: $ is undefined.

I should also mention that I am making use of a Master page, which references the JQuery as follow:

HTML
<script type="text/javascript" src="<%= Page.ResolveUrl("~/Scripts/jquery-1.4.1.min.js")%>"></script>
    <script type="text/javascript" src="<%= Page.ResolveUrl("~/Scripts/blend/jquery.blend.js")%>"></script>
    <script type="text/javascript" src="<%= Page.ResolveUrl("~/Scripts/ui.core.js")%>"></script>
    <script type="text/javascript" src="<%= Page.ResolveUrl("~/Scripts/ui.sortable.js")%>"></script>
    <script type="text/javascript" src="<%= Page.ResolveUrl("~/Scripts/ui.dialog.js")%>"></script>
    <script type="text/javascript" src="<%= Page.ResolveUrl("~/Scripts/ui.datepicker.js")%>"></script>
    <script type="text/javascript" src="<%= Page.ResolveUrl("~/Scripts/effects.js")%>"></script>


And my JQuery as follow:

JavaScript
<script type="text/javascript">
        $(document).ready(function () {
            $('#CloseButton').click(function () {
                $('#myForm').slideUp(1000);
                $('#Screen').css('display', 'none');

                return false;
            });
        });

        function EnlargeSlide() {
            $(document).ready(function () {
                $('#Screen').css({ opacity: 0.7, 'width': $(document).width(), 'height': $(document).height() });
                
                $('#myForm').slideDown('2500');

                return false;
            });
        }


I have similar code in another page, which works well in all browsers.
What might be the issue here?
Posted
Comments
   
I think the jquery-1.4.1.min.js file is getting linked.
Can you check that in the page source in IE 9 or with F12 key?
Andrew797 10-Dec-12 6:02am
   
what do you mean when you say "I think the jquery-1.4.1.min.js file is getting linked"?
   
You have written some lines to link the jQuery files.
And the very first line is
<script type="text/javascript" src="<%= Page.ResolveUrl("~/Scripts/jquery-1.4.1.min.js")%>"></script>.
And for executing the jQuery codes, this file is necessary.
I think this file is not getting added/linked to the rendered page.

Thaat's why I said you to check the page source or check using F12 key in IE9, whether this file is added or not. You should be able to get this file in the script tab of the window coming when you press F12.
Andrew797 10-Dec-12 6:21am
   
Thanks for the clarity. I have checked the source of the page now, and the file is added to the Head of the page
   
Does your project has one live link ? I mean website link ?
If yes, then please share, I will figure the problem out.
Andrew797 11-Dec-12 0:16am
   
Unfortunately, not yet. Thanks for the help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900