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>
    <h1> Chipmunks </h1>
    <p id="lead">Alvin</p>
    <p>Simon</p>
    <p>Theodore</p>
    
    <button>Press me</button>
    
    <script src="https://code.jquery.com/jquery-3.1.0.js"></script>
  </body>
</html>
 
$(function(){
  
  $("button").click(showMessage);
  
  function showMessage() {
    let name = $("#lead").text();
    
    alert(`${name} is the lead singer of the Chipmunks`)
  }
});
Output

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

Dismiss x