0
It’s just a test, wanted when I clicked on the table to show me a message, but when the page is loaded the event is triggered, wanted to know why this is happening
My code
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<table id="t">
<tr><td id="t1">one</td></tr>
<tr><td id="t2">two</td></tr>
</table>
<script type="text/javascript">
document.querySelector('#t').addEventListener('click', alert('ola mundo'), false);
</script>
</body>
</html>