you cannot just assign a text to the onClick eventhandler. Insted try building a function which would display hi when it is clicked. if you want to know more here is a reference link. https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onclick_html
Thankyou. It helped me.
I have another query: Can we add a image through a onclick attribute with the help of a function?
Thankyou. Your answer helped me out.