How can I exclude the placeholder from being hovered?
HTML:
<ul class="listing">
<li><p>red</p></li>
<li><p>green</p></li>
<li><p>blue</p></li>
<li id="li-placeholder"><p>placeholder</p></li>
</ul>
开发者_如何转开发
JS:
$(function() {
$(".listing > li > p").hover(function() {
// exclude placeholder
// try...
// $(".listing > li > p").not("#li-placeholder").hover(function() {
// $(".listing > li > p:not('#li-placeholder')").hover(function() {
$(this).css("cursor", "help");
});
})
$(".listing > li:not(#li-placeholder) > p")
That is the selector you are after. See it.
you placed the placeholder marker on the LI not on the P. Try
$(function() {
$(".listing>li:not(#li-placeholder)>p").hover(function() {
$(this).css("cursor", "help");
});
})
I Hope this will help you,
Jerome Wagner
精彩评论