Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery & IE crashing on $('#someDiv').hide();

Tags:

jquery

Well after a while of scratching my head and going "huh?" trying to figure out why IE would straight up crash when loading one of my pages loaded with jQuery goodness, I narrowed down the culprit to this line

$('div#questions').hide();

And when I say IE crashes, I mean it fully crashes, attempting to do its webpage recovery nonsense that fails.

I am running jQuery 1.4.2 and using IE 8 (haven't tested with any other versions)

my current workaround is this:

if ($.browser.msie) { 
    window.location = "http://www.mozilla.com/en-US/products/download.html"; 
}

For some reason I feel my IE users won't be very pleased with this solution though.

The div in question has a lot of content in it and other divs that get hidden and displayed again, and all of that works just fine and dandy, it is only when the giant parent div is hidden that IE flips out and stabs itself.

Has anyone encountered this or have any possible ideas of what is going wrong?

EDIT:

Everything is wrapped up in the $(document).ready(function() { }); And my code is all internal so I can't link it unfortunately.

EDIT: IE 8 crashing code found

<ol class="actionHelp">
    <li>List the tasks (or actions) that are involved in your pattern along the top (one per column)</li>
    <li>Put the starting point in the first column and the ending point in the last column.</li>
    <li>To fill in the middle, simply ask: "What happens next?" If only one thing ever happens next, then it should get 100%. If 70% of the time one thing happens next, and 30% of the time another thing happens next, then put 70 in one box and 30 in the other.</li>
    <li>Each row should add up to 100%</li>
    <li>The last row is the exit and should not have any percentages in it.</li>                
</ol>

I have no idea why this is causing problems in IE but here is the CSS

.actionHelp {
    margin: 0 0 0 20px;
}
.actionHelp li {
    margin: 5px 0;
}

Using an unordered list instead of an ordered list results in no crashing, but once I switch it back I get the crashes all over again, this element doesn't need to be ordered I just had it there as steps which make logical sense, I would still like to know why this is freaking out IE.

Does jQuery + IE + hiding an ol element = OMG IE FAIL? Or is there a workaround?

It appears to be affected any list element with a list-style other than none

like image 567
Jimmy Avatar asked Apr 02 '10 15:04

Jimmy


People also ask

What is jQuery used for?

jQuery is a lightweight, "write less, do more", JavaScript library. The purpose of jQuery is to make it much easier to use JavaScript on your website. jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code.

Is jQuery the same as JavaScript?

The main difference among the three is that JavaScript is client-side, i.e., in the browser scripting language, whereas jQuery is a library (or framework) built with JavaScript.

Is jQuery still used in 2021?

6 Reasons Why We Still Use jQuery in 2021. jQuery has been around for over 10 years, which is a long time for a code library. It's still one of the most popular JavaScript libraries in web development. We love jQuery here at Atypic and still utilize it in our projects.

Which is better js or jQuery?

Though JavaScript is the basic language from which jQuery has evolved, jQuery makes event handling, DOM manipulation, Ajax calls much easier than JavaScript. jQuery also allows us to add animated effects on our web page which takes a lot of pain and lines of code with JavaScript.


1 Answers

Your problem obviously is not div#questions itself. Can you try removing (or commenting out) all of div#questions's contents and adding each element back, one at a time, until IE starts crashing again?

Once you've found the culprit, then do the same thing again for that element, removing all of its contents and adding each element back, testing after each one.

Keep doing this until you find the real source of the problem. I know this is a pretty low-tech solution, but often it's also the quickest one.

like image 128
Christopher Parker Avatar answered Sep 18 '22 17:09

Christopher Parker