Is "func" same as "function" while using the onclick event to handle html in js? | SoloLearn: Learn to code for FREE!

0

Is "func" same as "function" while using the onclick event to handle html in js?

4/23/2020 2:20:40 AM

Peter Tabi

2 Answers

New Answer

+2

No, function is a reserve keyword to declare a function where as func is an identifier or Name that can be used as function name. So if you want to call function in onclick use function name that is: JS: function func(){ alert("trial"); } HTML: <button onclick="func()">try me</button>

+1

I understand that now. Thanks a lot