Sorry, my bad.
I forgot to set the proper scope on the function and to pass the object in ma call.
So I close the issue.
Working code with call from onclick
<div class="my-class" data-href="https://www.google.com" onclick="myFunction.call(this)" >
and following myFunction()
function myFunction() {
window.location = $(this).attr("data-href");
return false;
};
window.myFunction = myFunction;