Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery and internet explorer (IE9) issue

I am having a WTF moment here.

I have been working with jQuery since I don't remember. It could be that I am really tired and my brain is not working.

I have being working on a website since couple of months and for some reason I have not tested some of its functionality on internet explorer.

Yesterday I started to do so and for some reason $(some_element).parent() is not working.

I did setup an example page on my private server.

The code is

<html>

<header>
    <script type="text/javascript" charset="utf-8" src="jquery.js"></script>
</header>

<body>
    <div id="tester">
        <div id="tester2">
                <div id="tester3">
                    <div id="tester4">
                    </div>
                </div>
        </div>
    </div>
</body>

<script type="text/javascript" charset="utf-8">
    $(function(){

        parent = $("#tester4").parent();
        $(parent).css("width", "800px");
        $(parent).css("height", "800px");           
        $(parent).css("border", "solid 1px red");

        console.log(parent);

    });
</script>
</html>
like image 580
thedethfox Avatar asked May 16 '12 20:05

thedethfox


1 Answers

It doesn't like the implicit declaration of parent. Try var parent to keep it out of the global scope.

like image 153
AlienWebguy Avatar answered Nov 02 '22 15:11

AlienWebguy