Last active
September 6, 2020 00:02
-
-
Save jerlyrosa/0cba3f57ee3ad5030e4fafc4696eb4c9 to your computer and use it in GitHub Desktop.
Acceder a un elemnto por su ID con el DOM en javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
<p id='text-1'>Lorem ipsum dolor sit amet consectetur adipisicing elit. Harum accusamus est eveniet ad, | |
quibusdam sapiente nesciunt cum adipisci possimus doloribus a maxime vitae alias sequi | |
ipsum labore enim distinctio quaerat?</p> | |
<p id='text-2'>Lorem ipsum dolor sit amet consectetur adipisicing elit. Harum accusamus est eveniet ad, | |
quibusdam sapiente nesciunt cum adipisci possimus doloribus a maxime vitae alias sequi | |
ipsum labore enim distinctio quaerat?</p> | |
<script> | |
var element = document.getElementById('text-1');// Acceder un elemeto con el ID | |
console.log(element) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment