Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  
  <button id="b1">Afficher un message dans 2s</button>
  <script type="text/javascript" src="s1_script_externe.js">
    <!-- en fait, jbin injecte tout seul le code tout seul JS ci-contre, mais dans un exemple réel, il y faire référence via une balise <script> -->
  </script>
</body>
</html>
 
// jshint eqeqeq:true, undef:true, devel:true, browser:true, esnext: true
window.addEventListener("load", function() {
  const b1 = document.getElementById('b1');
  b1.addEventListener("click", function() {
    b1.textContent = "(en attente)";
    b1.disabled = true;
    setTimeout(function() {
      alert("message");
      b1.disabled = false;
      b1.textContent = "Afficher un message dans 2s";
    }, 2000);
  });
});
Output

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

Dismiss x
public
Bin info
goncalvepro
0viewers