Javascript Changing Website Content
Javascript Changing Website Content
changingwebsitecontent.html
!
!
!
<!doctype html>
<html>
<head>
<title>Learning Javascript</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<button id="textChanger">Change first div text</button>
<div id="firstDiv">This is some text</div>
<button id="textAppender">Append some text</button>
document.getElementById("textAppender").onclick=function() {
document.getElementById("secondDiv").innerHTML=document.getElementById("secondDi
v").innerHTML + "great!";
document.getElementById("textCreator").onclick=function() {
document.getElementById("emptyDiv").innerHTML="<ul><li>Cat</
li><li>Dog</li></ul>";
</script>
</body>
</html>