Skip to content

Instantly share code, notes, and snippets.

@Draketheb4dass
Created December 4, 2019 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Draketheb4dass/5394874c54c032770cd8d5d7f78515e7 to your computer and use it in GitHub Desktop.
Save Draketheb4dass/5394874c54c032770cd8d5d7f78515e7 to your computer and use it in GitHub Desktop.
Dom manipulation with getElementById
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Challenge: ID changer</title>
<style>
#id-card {
border:1px solid black;
border-radius:5px;
width: 400px;
font-family: monospace;
padding: 6px;
background: rgb(201, 255, 224);
}
#id-name {
float: right;
}
</style>
</head>
<body>
<div id="id-card" style="">
<h3>Identification card</h3>
<img src="https://www.kasandbox.org/programming-images/creatures/Winston.png">
<h1 id="id-name">First last</h1>
</div>
<script>
var nameEl = document.getElementById('id-name');
nameEl.innerHTML = 'Jephte Colin'
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment