Onclick button is not working


can someone help me out?

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

2 Likes

you should have to try it.

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.