tags:

views:

25

answers:

2

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"); 
    });
}​)​
+6  A: 
$(".listing > li:not(#li-placeholder) > p")

That is the selector you are after. See it.

alex
Of course, why didn't I see that. Need to goto bed. Cheers Alex
FFish
A: 

Hello,

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

Jerome WAGNER