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>
<input type="text" class="valor" value="Sou um valor">
  
  <p class="texto">Sou um texto</p>
</body>
</html>
 
// Troca pra textContent e ve o que acontece
var valor = document.querySelector('.valor').value;
console.log(valor)
//  Troca pra value
var texto = document.querySelector('.texto').textContent;
console.log(texto)
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers