Hello,
The following are two methods of building a link that has the sole purpose of running JavaScript code. Which is better in terms of functionality, page load speed, validation purposes, etc.?
or
The following are two methods of building a link that has the sole purpose of running JavaScript code. Which is better in terms of functionality, page load speed, validation purposes, etc.?
Code:
function myJsFunc() {
alert("myJsFunc");
}
Code:
<a href="#" onclick="myJsFunc();">Run JavaScript Code</a>
or
Code:
function myJsFunc() {
alert("myJsFunc");
}
Code:
<a href="javascript:void(0)" onclick="myJsFunc();">Run JavaScript Code</a>