0

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

23rd Apr 2020, 2:20 AM
Peter Tabi
Peter Tabi - avatar
2 Réponses
+ 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>
24th Apr 2020, 2:06 AM
abhishek kuradia
abhishek kuradia - avatar
+ 1
I understand that now. Thanks a lot
24th Apr 2020, 9:48 AM
Peter Tabi
Peter Tabi - avatar