document.querySelector("ul").onclick = function (e) { // 判断当前是否点击的是li元素,是的话就拼接字符串 if (e.target.tagName === "LI") { e.target.innerHTML = e.target.innerHTML + "."; } };