I am making a calculator in HTML. I want to clear the result using the Clear button. But the thing does not work.
This is my HTML code for the clear button:
<button onclick="clear()">C</button>
This is my Javascript code for this function:
function clear()
{
document.getElementById('text').innerHTML=" ";//text is the ID of the paragraph tag which holds the string which the user has passed
document.getElementById('answer').innerHTML=" ";//answer is the ID of the paragraph tag which shows the answer
}
Please Help me out. Thanks in advance!!