I am calling the javascript function while from the HTML onClick event. I works fine when the page is loaded but when i click the button while the document is not ready it gives undefined function error in the console.
<a onclick="myfunc(params)" href="javascript:void(0)" >Click Me</a>
myfunc is defined in another js file.