je me suis vite fait cette fonction pour un im script en utilisant:jQuery - IE retour de 0 enfants
$.fn.liCount = function(){
var i=0;
$(this).children().each(function(){
i++;
});
return Number(i);
}
problème est
retourne IE 0, quelqu'un sait pourquoi?
alert($("ul").liCount());
modifier:
<div id="prev-quotes">
<ul id="quote-list">
<li id="quote_content_wrapper" >
<ul>
<li class="quote_li">
<span class="service_quote"><a href="#">Web Design Services</a></span>
<br>
<span class="cost_quote"><strong>£192</strong> - <a id="7" href="#">delete</a> | <a id="7" href="#">view</a></span>
</li>
<li class="quote_li">
<span class="service_quote"><a href="#">Web Design Services</a></span>
<br>
<span class="cost_quote"><strong>£192</strong> - <a id="7" href="#">delete</a> | <a id="7" href="#">view</a></span>
</li>
<li class="quote_li">
<span class="service_quote"><a href="#">Web Design Services</a></span>
<br>
<span class="cost_quote"><strong>£192</strong> - <a id="7" href="#">delete</a> | <a id="7" href="#">view</a></span>
</li>
</ul>
</li>
<li>
<a id="first-quote" href="#">Previous Quotes</a>
<img height="16" width="16" id="warning" src="images/for_web/check_mark.png">
</li>
</ul>
</div>
Merci aussi. –
ne fonctionne toujours pas: element_delete.parents ('li: eq (0)'). Remove(); \t \t \t \t \t \t if ($ ("# quote-list> li> ul> li.quote_li") de longueur. == 5) { \t \t \t \t \t \t \t $ ("# quote_content_wrapper"). Css ("hauteur", "auto"); \t \t \t \t \t \t} else if ($ (longueur "# quote-list> li> ul> li.quote_li"). == 0) { \t \t \t \t \t \t \t $ ("warning #") .attr ("src", "images/for_web/warning.png"); \t \t \t \t \t \t \t} –