This is not recommended, but you can do it all like this:
<a href="#" onClick="function test(){ /* Do something */ } test(); return false;"></a>
But I canβt think of any situations where it would be better than writing a function elsewhere and calling it onClick .
jvdub source share