html - jquery not in a child div (can I use find?) -


i trying select whole div not specific div inside main div. example follows:

<div id="main_holder">    <div id="secondholder">       <div id="thirdholder">          <div id="dividonotwanttouse" class="notused"></div>       </div>    </div> </div> 

i trying simple click see when click on div, shouldn't alert.

$('#main_holder').not('#main_holder.notused').click( function(event) {     alert( 'pullmenu clicked' ); }); 

it's not working, best approach? there way use find in not selector?

example works:

$('#main_holder').find('#dividonotwanttouse').css({ border: '5px solid red' }); 

solution arun:

$('#main_holder').click( function(event) {     if(!$(event.target).closest('.notused').length)     {         alert( 'pullmenu clicked' );     } }); 

try

$('#main_holder').click( function(event) {     if(!$(event.target).closest('.notused').length){         alert( 'pullmenu clicked' );     } }); 

demo: fiddel


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -