Problem with Css & Javascript
I am having nested DIV's. Below is the Example.
<div id="one">
<div id="two">
</div>
</div>
I am calling a javascript function when we click on div one and div two.
Now the problem is sometimes the size of div two is large so that div one goes behind div two. Actually if i click div two i want to call both div one and div two. Since the javascript function name is dynamic, i am stuck.
开发者_StackOverflowAny idea how to call both js functions when we click div 2.
You might find the discussion here interesting. It gives good explanation and examples of event bubbling and propagation.
At the end of div 2's click handler, you could call div 1's.
UPDATE:
What I meant is you could fire a click event on div 1 when div 2 is called.
using jQuery you could do something like this
$('div2').click(function() {
$(this).parent().click();
}
精彩评论