Whenever the ADD div is clicked, "+" should be displayed on the textbox. The same goes for SUBTRACT, MULTIPLY, and DIVIDE. However, I am struggling to make the operators show on the textbox. Here is what I have managed to come up with so far.
<!DOCTYPE html>
<html>
<body>
<div class="leftDiv">
<div id="colorblock">
<div id = "add" class = "blocks" onclick="displayOptr()">ADD</div>
<div id = "subtract" class = "blocks">SUBTRACT</div>
<div id = "multiply" class = "blocks">MULTIPLY</div>
<div id = "divide" class = "blocks">DIVIDE</div>
</div>
</div>
<input type = "text" size="1" id = "operator">
<script>
function displayOptr() {
var optrArr =["+","-","*","/"];
for (var i = 0; i < optrArr.length; i++){
if (i==0){
document.getElementById("operator").value = "+";
} else if (i==1){
document.getElementById("operator").value = "-";
} else if (i==2){
document.getElementById("operator").value = "*";
} else if (i==3){
document.getElementById("operator").value = "/";
}
}
</script>
</body>
</html>