I have two HTML elements that appear one over another, each having its own onclick event. Code example:
<table>
<tr>
<td onclick="expand('table2')">
<div>
name<img src="img.gif" onclick="open_popup()">
</div>
</td>
</tr>
<tr>
<td>
<table id="table2"><tr><td>some text</td></tr></table>
</td>
</tr>
</table>
<script type="text/javascript">
function expand(tableid){
$("#"+tableid).slideToggle();
}
function open_popup(){
alert('popup opened');
}
</script>
The problem is that if I want to click the image and open the popup, it also triggers the "expand" function, so is there any way or any suggestion that I might use to make the click on the image to trigger only the image event, without also triggerin the "expand" function? I am looking for a solution that doesnt require me to change current layout.
My goal is to make the image click trigger the open_popup() function, while any click around the image, but inside the table row, to trigger the other function.
Thank you