How can I write a function within the onclick event of a button
onclick
What I want to do is something similar to this:
<button onclick="(function(){ console.log('some code here') })">My button</button>
You'll need to invoke the function:
<button onclick="(function(){ console.log('click') })()">My button</button>
<button> onclick="(function(){console.log('click')})()" >Button </button>