Skip to content

Instantly share code, notes, and snippets.

@nikkaroraa
Created November 13, 2017 19:03
Show Gist options
  • Save nikkaroraa/271c2a05127c76bb73fe76fa986fa062 to your computer and use it in GitHub Desktop.
Save nikkaroraa/271c2a05127c76bb73fe76fa986fa062 to your computer and use it in GitHub Desktop.
Updating DOM Nodes
<!DOCTYPE html>
<html>
<head>
<title>DOM Manipulation</title>
</head>
<body>
<p id="paraId">First Paragraph</p>
</body>
<script>
//accessing the node with id="paraId"
var firstPara = document.querySelector('#paraId');
//updating the text of the node
firstPara.innerText = 'Modified Paragraph';
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment