I want to disable all click events on my page but some of events are still getting called, suppose I have html as below
<div id='parent'>
<table>
<tr>
<td><input type = 'text'/></td>
<td><select><option>A</option><option>B</option></select></td>
<td><a href='#' onclick="alert('Called')">Click </a></td>
</tr>
<tr>
<td>dscsdcd</td>
<td>dscsdcd</td>
<td>dscdscdsc</td>
</tr>
<tr>
<td>sdcdsc</td>
<td>dssdcdsc</td>
<td><input type='submit' value='Button'/></td>
</tr>
</table>
</div>
And script as below
$('#parent').click( function(e)
{
e.stopPropagation();
e.preventDefault();
e.stopImmediatePropagation();
return false;
});
when I click anchor tag, it alerts Called
which it shouldn't because I am disabling event for it's parent. Looks like anchor tag is overriding onclick
, if it is then how to prevent it? if not, then what could be the solution?
JS Fiddle
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…