javascript ---每次用户按下按钮并取消上一个时获取新数据

问题描述

每当用户按下我要在<h1>上覆盖用户插入的任何按钮(在这种情况下,始终是日期)时,有人会帮助我吗?这是代码

const header = document.createElement("h1");
header.classList.add("star-sign");
div.appendChild(header);

If ('statement'){header.innerHTML = 'execute'}

解决方法

Ciao,通过其id获取h1元素,并在用户按下按钮时进行设置。例如,如果您想更改innerHTML:

List<Selection<?>> selectionList = root.getCompoundSelectionItems();
selectionList.add(root.get("id"));
selectionList.add(root.get("name"));

query.multiselect(selectionList);
,

单击按钮时,可以设置textContent的{​​{1}}属性。请参见下面的示例。

h1
document.querySelector('#button').addEventListener('click',() => {
  document.querySelector('#date_heading').textContent = document.querySelector('#date_input').value;
});