That's because the click event from a LI bubbles up to the DIV. Two
simple ways to avoid it:

$('#plan').click(function(e){
   //abort if a LI was clicked
   if ( $(e.target).is('li') )
      return false;

   //then do stuff()
});

(alternatively use if ( e.target.id != 'plan' ))

or a less efficient but explanative way:

$('#plan').click(function(){
   //do stuff
});
$('#plan li').click(function(e){ //or #plan > *
     return false;
     //returning false calls e.stopPropagation() and e.preventDefault
()
  });

cheers,
- ricardo

On Apr 27, 10:26 am, Remon Oldenbeuving <r.s.oldenbeuv...@gmail.com>
wrote:
> It looks obvious, but aint working for me.
>
> On Mon, Apr 27, 2009 at 3:16 PM, Mauricio (Maujor) Samy Silva <
>
> css.mau...@gmail.com> wrote:
>
> > De: "gostbuster" <jeremyescol...@gmail.com>
> > Assunto: [jQuery] Re: div contains <li> -> select div but NOT li
> > Hi,
> > Yes of course I could do this, but Jquery selectors don't allow what I
> > wish to do?
> > Thanks.
>
> > ------------------------------------------------------------------------------
> > How about:
> > $('#plan').not('ul').click(function(){...}
> > Maurício

Reply via email to