gpt4 book ai didi

JQuery .find() 在 IE 中对我来说不起作用

转载 作者:行者123 更新时间:2023-12-01 07:01:17 25 4
gpt4 key购买 nike

我一整天都在努力解决这个问题,并尝试执行此 question 中概述的步骤。但我找不到问题所在。

我正在使用 Quicktree 插件来显示无序列表中的树。

如果我删除该行

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

它可以工作,但如果包含该行,则不会。

在 Chrome 和 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>

最佳答案

更改<a/></a>

关于JQuery .find() 在 IE 中对我来说不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3709942/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com