This is just a simple javascript code to change display or background or just to see if I can change the css attribute using javascript at all.
This is based on an example.
But for some reason, I cannot change the attribute using the js function I defined myself.
HTML code
<div id="question"> testting javascript</div>
<button onclick="close()">Close</button>
JS code
function close(){
document.getElementById("question").style.display = "none";
document.getElementById('question').style.backgroundColor = "#f3f3f3";
}
The Full code
<div id="question"> testting javascript</div>
<button onclick="close()">Close</button>
<script>
function close(){
document.getElementById("question").style.display = "none";
document.getElementById('question').style.backgroundColor = "#f3f3f3";
}
</script>