2010-09-14 7 views
1

J'ai lutté avec cela toute la journée et j'ai essayé de passer par les étapes décrites dans ce question mais je ne peux pas repérer le problème. J'utilise le plugin quicktree pour afficher un arbre de ma liste non triée.JQuery .find() ne fonctionne pas dans IE pour moi

Si je supprime la ligne

<li><a href="#" title="Add a New Page" class="addnewpage-icon addnewpage" id="addnewpageid5">hello<a/>world</li> 

cela fonctionne, mais avec la ligne inclus ne sera pas.

C'est bon dans Chrome et FF.

<head> 

<title>jQuery quickTree plugin example</title> 
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> 
<meta http-equiv="Content-Style-Type" content="text/css" /> 

<link rel="stylesheet" type="text/css" href="http://www.prismstudio.co.uk/tutorials/quickTree/0.4/quickTree.css" /> 

<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script> 



<script type="text/javascript"> 

jQuery.fn.quickTree = function() { 
return this.each(function(){ 

//set variables 
var $tree = $(this); 
var $roots = $tree.find('li'); 

//set last list-item as variable (to allow different background graphic to be applied) 
$tree.find('li:last-child').addClass('last'); 

//add class to allow styling 
$tree.addClass('tree'); 

//hide all lists inside of main list by default 
$tree.find('ul').hide(); 

//iterate through all list items 
$roots.each(function(){ 

//if list-item contains a child list 
if ($(this).children('ul').length > 0) { 
    //add expand/contract control 
    $(this).addClass('root').prepend('<span class="expand" />'); 
} 


}); //end .each 

//handle clicking on expand/contract control 
$('span.expand').toggle(
//if it's clicked once, find all child lists and expand 
function(){ 
$(this).toggleClass('contract').nextAll('ul').slideDown(); 
}, 
//if it's clicked again, find all child lists and contract 
function(){ 
$(this).toggleClass('contract').nextAll('ul').slideUp(); 
} 
); 
}); 
}; 

</script> 

<script type="text/javascript"> 
$(document).ready(function(){ 
    $('ul.quickTree').quickTree(); 
}); 
</script> 

</head> 
<body> 



<ul id="0" class="quickTree"> 
<li id="currentId4"><a href="editpage/5" class="show-always">home</a> 
    <ul id="4"> 
<li><a href="editpage/5" class="show-always">home</a> one</li> 
<li><a href="editpage/5" class="show-always">home</a> two</li> 
<li><a href="editpage/5" class="show-always">home</a> nmnmnm</li> 
<li><a href="editpage/5">home</a> aaaaa</li> 
<li><a href="editpage/4" class="show-always">hello<a/>world</li> 
<li><a href="editpage/5" class="show-always">home</a> nmnmnm</li> 
<li><a href="#" title="Add a New Page" class="addnewpage-icon addnewpage" id="addnewpageid5">hello<a/>world</li> 
</ul> 
    </li> 
    <li id="currentId5"><a href="editpage/5" class="show-always">where</a> 
    <ul id="4"> 
<li><a href="editpage/5" class="show-always">home</a> one</li> 
<li><a href="editpage/5" class="show-always">home</a> two</li> 
<li><a href="editpage/5" class="show-always">home</a> hghghgh</li> 
</ul> 
</li> 
<li><a>nmnmnmnm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a/></li> 

Répondre

5

changement <a/> à </a>

+0

Ha ha, j'ai les yeux fixés depuis si longtemps que je ne pouvais pas voir le bois pour les arbres! Vous ne pouvez pas accepter votre réponse en raison de la nouvelle fonctionnalité. Merci! –

+0

@Nicholas quelle nouvelle fonctionnalité? – jrharshath

+0

@Here Be Wolves - Celui qui ouvre un dialogue qui compte le temps écoulé jusqu'à ce que vous puissiez accepter une réponse. La première fois que je l'ai vu. –