console
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>监听器</title>
</head>
<body>
<table id="outside">
<tr><td id="t1">one</td></tr>
<tr><td id="t2">1</td></tr>
</table>
<script>
(function() {
const modifyText = (text) => {
const t2 = document.querySelector('#t2');
if (t2.firstChild.nodeValue === text) {
t2.firstChild.nodeValue = '1111';
} else {
t2.firstChild.nodeValue = text;
}
}
const element = document.querySelector('#outside');
element.addEventListener('click', function() { modifyText('four') }, false);
})()
</script>
</body>
</html>