How can I pass checkbox onclick event to parent onclick ?
Posted
by Kim
on Stack Overflow
See other posts from Stack Overflow
or by Kim
Published on 2010-05-03T10:34:20Z
Indexed on
2010/05/03
10:38 UTC
Read the original article
Hit count: 356
I a with an onclick event and , and inside it.
When I click on the checkbox then the div-onclick event doesnt fire - I would like it to fire without having to dublicate the onclick onto the checkbox.
<div id="id-tag" onclick="do()">
<span>text</span>
<img src="pic.jpg" />
<input type="checkbox" name="mycheck" />
</div>
I know the div-idtag but ideally would like to avoid specifying it inside the checkbox.
Using another function call on the checkbox onclick to call the parent is NOT what I am looking for, like
onclick="run_parent_onclick()"
but this is okay (untested)
onclick="this.parent.click()"
© Stack Overflow or respective owner