I can't get this document.getbyelementid to work


#1

it’s supposed to make the red circle disappear when clicked, but it doesn’t
checked in a few browsers, what could be the problem?

<head>

<title>Javascript</title>

<style type="text/css">

.circle {

width: 120px; 
height: 120px;
border-radius:50%;
float:left; 
margin-right:50px;

}

#red-circle {

background-color: red;

}

#blue-circle {

background-color: blue;

}

#yellow-circle {

background-color: yellow;

}

	</style>

	</head>

<body>

<div class="circle" id="red-circle"></div>

<div class="circle" id="blue-circle"></div>

<div class="circle" id="yellow-circle"></div>


<script type="text/javascript">

	documnet.getElementById("red-circle").onclick = function() {
	
		document.getElementById("red-circle").style.display = "none";
	
	}

	
	</script>

</body>	

#2

documnet.getElementById("red-circle").onclick = function() {

find out the typo


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.