📜  js 等待元素存在 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:31.710000             🧑  作者: Mango

代码示例1
while(!document.querySelector(".my-selector")) {
  await new Promise(r => setTimeout(r, 500));
}
// now the element is loaded