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>
  <div class="des">
    
    <h1>As I was walking up the stairs</h1>
    
    <p>I met a man who wasn't there</p>
    
    <h1>He wasn't there again today</h1>
    
    <p>I wish, I wish, that man would go away</p>
    
  </div>
  
</body>
</html>
 
// Will return a NodeList even if there is only one element found
var heading = document.querySelectorAll('.des > h1');
heading[1].style.color = 'red'; // NodeList is similar to an array
var first_heading = document.querySelector('.des > h1');
first_heading.style.color = 'blue';
Output

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

Dismiss x
public
Bin info
hitautodestructpro
0viewers