Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <button id="b1">Afficher un message dans 2s</button>
</body>
</html>
 
(function(){ // protection de l'environnement global
let b1 = document.querySelector('button#b1');
b1.addEventListener("click", () => {
  let previousContent = b1.textContent;
  b1.textContent = "(en attente)";
  b1.disabled = true;
  setTimeout(() => {
    alert("message");
    b1.textContent = previousContent;
    b1.disabled = false;
  }, 2000);
});
  
})();
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
pchampinpro
0viewers