javascript - Selecting nested elements -


i have page hierarchy this:

<div class="panel" attribute-id="1">   <button class="delete">   <div class="panel" attribute-id="2" association-id="20">     <button class="delete">   </div> </div> .... 

so have bunch of these panels nested panels inside, , i'm trying create on on click handler delete buttons of top level panels (so ones inside panels not have association id). different between parent , child panels child ones have attribute "association-id".

so can select top level panels so:

$('.panel[attribute-id]:not([association-id]') 

but if try delete buttons from these like:

$('.panel[attribute-id]:not([association-id] .delete') 

obviously i'm still going child buttons.

i can't modify html in anyway, how go doing this?

$(':not(.panel[attribute-id][association-id]) > .delete') 

seems trick.

jsfiddle

i've changed .panel-group .panel work html provided.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -