i\'m trying to create a simple calculator, when a button is clicked its value is shown in the text field and the button \"C\" should clear the text field but its onclick=\"
Your HTML has problems, but the reason your function is not working is because of its name "clear", which is already defined by document.clear().
document.clear()
Change the name of that function to something like clearField() and it will work.
clearField()