[jQuery] Interface > Sortables > Crash On IE

[jQuery] Interface > Sortables > Crash On IE


I had this bug, when opening the page in IE it always caused to crash.
I was trying to use the sortables on a simple ul li. Here's the fix /
the thing you shouldn't do when implementing....
/* ********* THIS FAILS!!!! ****/
<div id="sort">
<ul>
<li class="sortableitem">1</li>
<li class="sortableitem">2</li>
<li class="sortableitem">3</li>
</ul>
<script type="text/javascript">
$('#sort ul').Sortable({ accept : 'sortableitem' } )
</script>
</div>
/* ********* THIS WILL WORK!!!! ****/
<div id="sort">
<ul>
<li class="sortableitem">1</li>
<li class="sortableitem">2</li>
<li class="sortableitem">3</li>
</ul>
</div>
<script type="text/javascript">
$('#sort ul').Sortable({ accept : 'sortableitem' } )
</script>
Don't put the script to activate the sortables inside of any element
of the item that you pass to the jQuery function (in this case <div
id="sort"></div>). This will cause IE to crash. FF is still fine
tho'... Anyway it's bad code. Put it to the document load function and
you should be on the save side.