I’ve got situation:
<div id="main">
<div id="a"></div>
<div id="b"></div>
</div>
On my web page, element B is under A. How can I bind click to only those A element which are above B elements? For example:
$('#main, #main > #b').click(function(){
//something
});
EDIT2: this code is OK when I click on parent div, or “b” element but when I click on “A” element which is above nothing happens.
in general I want to click only on B element, but when A element is above B I want to fire up event to.
thanks!
EDIT: unfortunately I cannot modify HTML code.
Check this out, as i left a comment in your question, i made a script to show you what i’ve mean by using jquery library for example, HERE IS THE LINK
HTML:
CSS:
jquery script: